Before we begin, you will want to install the joystick package to your device. Type sudo apt-get –y install joystick
at the command line and press Enter. The joystick package includes an application called jstest
, which will help you identify and troubleshoot your controllers.
When a controller is connected and recognized by the Raspberry Pi, a new entry will be made in the /dev/input/
folder. This folder contains a list of all connected input devices. You should see files like event0
, mouse0
, and kb0
depending on what has been connected. When your controller is connected, you should see a new item called js0
. The 0
at the end of the item indicates the order in which it was connected. You can have multiple items connected, and they will each get an increasing number.