User manual

32
3 Traffic light
To turn on and off a single LED may be very exciting at first, but you do not really need a computer for this. A
traffic light with a typical luminous cycle that is changing from green to yellow and then to red, and then
from the light combination red and yellow back to green, can be easily built with three LEDs and hence,
shows more programming techniques in Python.
Build the pictured circuit on the breadboard. In order to control the LEDs we are going to use three GPIO
ports and a joined ground wire. The GPIO port numbers in BCM mode are shown in the drawing on the
Raspberry Pi.
Fig. 3.1: Breadboard assembly for the traffic light.
Components required:
1x breadboard
1x LED red
1x LED yellow
1x LED green
3x 220-ohm series resistor
4x connecting wire