Operation Manual
By extending the code to look for multiple push-buttons, each on an individual GPIO pin, you could even create a simple four-
button game controller. For example, you could combine the preceding code with the Raspberry Snake game from Chapter 11,
“An Introduction to Python”, to turn the Raspberry Pi into a simple games console. You can also combine both input and output
examples into a single program, which waits for the button to be pushed and then turns on the LED by sending the output pin
high. To ensure that you’ve understood the concepts in this section, try creating that combined program now. If you get stuck, or
you want to check your method, turn to Appendix A, “Python Recipes”, for a sample solution.
Moving Up From the Breadboard
As the previous examples in this chapter have shown, breadboards are excellent for quickly creating prototype circuits for
experimentation. They’re fast and reusable, and they don’t damage components.
However, breadboards also have some disadvantages. They’re bulky, expensive, and prone to loose connections—which can
result in critical components falling out, especially while the breadboard is being transported from place to place. Figure 12-7
demonstrates this perfectly: despite best efforts, the push-button component is only loosely secured in the breadboard, and is
likely to fall out if the circuit is handled roughly.
Figure 12-7: A sample breadboard circuit, with loose-fitting components