Setting up the switches
The next piece of hardware we will set up is the six switches that will be used for the four direction keys, back, and enter. Although they can be easily remapped to whatever set of controls you like.
The first step here is to solder wires with a 0.1 inch female pin socket at one end to each switch terminal. This process is very similar to what we did for the arcade buttons in Chapter 3, Mini Retro Arcade Cabinet.
Once this is done, it would be worth wrapping the connections in some insulation tape to give the cables extra relief from the strain, as shown in the following image:
Next, it is time to wire the switches to the Pi. To do this, we will follow the same wiring diagrams used in the previous section to connect the LCD.
Once this is done, we can move on to the software setup for the buttons. To interface with the GPIO hardware, we will use the sysfs bindings that are available by reading and writing to files under the
/sys/class/gpio/
directory. This method is used...