Major work on the joysticks has been completed. They were developed for microcomputer Raspberry Pi, and they are incompatible with PC. Obviously, they were created for retro games (Sega & NES), in particular for cooperative games.
By the way, these homemade "inventions" are in harmony with LEGO-case for RPi.
To make the gamepads thinner, I decided to move all of the resistors
and a big pile of wires on a separate circuit that connects the joystick to RPi.
As an emulator of retro consoles I recommend RetroArch. On the Internet there are many lessons on how to configure it on the Raspberry Pi.
To simulate keystrokes I'm using pikeyd. This is a program that allows you to assign a pin to a key on the keyboard.
To install run the following commands:
$ sudo git clone https://github.com/mmoller2k/pikeyd.git $ cd pikeyd $ sudo make $ sudo modprobe uinput $ sudo cp pikeyd /usr/local/bin/pikeyd
Place the configuration file in the path
/etc/pikeyd.conf. I use this configuration:
# format: # [keycode from /usr/include/linux/input.h] [whitespace] [GPIO pin no] KEY_W 14 KEY_S 9 KEY_A 30 KEY_D 11 KEY_Z 25 KEY_X 31 KEY_C 7 KEY_Q 8 KEY_Y 4 KEY_J 17 KEY_H 27 KEY_G 18 KEY_B 23 KEY_N 24 KEY_M 22 KEY_T 10
Wiring diagram of the buttons:
Now we want to launch the uinput module every time we boot up automatically:
$ sudo nano /etc/modules
Scroll to the bottom of the file and add: