The traffic light
Section 2: Wiring and the traffic lightLesson 2.2 · ⏱ 8 min
Three LEDs on three pins: red 13, yellow 12 and green 11. We light each colour alone for a while, then move to the next colour.

🖥️ What happens on the stage?
Red for 3 seconds, then yellow for a second, then green for 3 seconds, and it repeats.
📌 Another example: a traffic light with different times
Green 1.5 seconds, yellow shorter (0.7), and red 1.5.




✍️ Practise
Build the traffic light.
✍️ Practise here in the lesson✖ Close the labor open the lab in a new page ↗
🎯 Challenge yourself
Easy
Night mode: only the yellow blinks.
👀 Show the solution🙈 Hide the solution


Result: the yellow blinks.
Medium
A pedestrian light: only red and green, taking turns every second.
👀 Show the solution🙈 Hide the solution


Result: red, then green.
Hard
Before the red, the yellow blinks 3 times as a warning.
👀 Show the solution🙈 Hide the solution


Result: green, then blinking yellow, then red.

