Project 02: Traffic Lights
1. Overview
In this project, we adopt three LEDs( red, yellow and green), a speaker on micro:bit board and 5x5 LED matrix to make a model of traffic lights.
2. Components
|
|
|
|---|---|---|
micro:bit board *1 |
micro:bit T-type expansion board *1 |
micro USB cable *1 |
|
|
|
red LED *1 |
yellow LED *1 |
green LED *1 |
|
|
|
220Ω resistor *3 |
jump wires |
breadboard *1 |
|
|
|
battery holder *1 |
traffic lights card *1 |
3. Components Knowledge
Speaker

Micro: bit comes with a speaker, which makes it easy to make sound in your project.
4. Wiring Diagram

Note: the micro:bit board needs to be inserted into the T-type expansion board as shown below. The micro:bit board LED matrix should be on the same side with the logo of the expansion board.

5. Code Flow

6. Test Code
The code file is provided in folder Project 02:Traffic Lights, file Project-02-Traffic-Lights.hex.

Load code blocks:

7. Test Result
For Windows 10 App, click “Download” . For browsers, send the downloaded “.hex” file to the micro:bit board.
After downloading the code to the board, the green LED turns on and the 5×5 LED matrix counts down 6 seconds. After the green LED is off, the yellow LED flashes and the matrix counts down 3s with speaker sounding. At last, the red LED is on with a countdown of 6s. These actions repeat.
ATTENTION: If the wiring is correct but you cannot see the results, press the reset button on the back of the board.

When powering on via external power supply, turn the DIP switch to ON.











