There's more...

Using the GPIO pins on the Raspberry Pi must be done with care since these pins are directly connected to the main processor of the Raspberry Pi without any additional protection. Caution must be used as any incorrect wiring will probably damage the Raspberry Pi processor and cause it to stop functioning altogether.

Alternatively, you could use one of the many modules available that plug directly into the GPIO header pins (reducing the chance of wiring mistakes):

For example, the Pi-Stop is a simple pre-built LED board that simulates a set of traffic lights, designed to be a stepping stone for those who are interested in controlling hardware but want to avoid the risk of damaging their Raspberry Pi. After the basics have been mastered, it also makes an excellent indicator to aid debugging.

 

Just ensure that you update the LED CONFIG pin references in the ledtest.py script to reference the pin layout and location used for the hardware you are using.

See the Appendix, Hardware and Software List, for a list of Raspberry Pi hardware retailers.