انتقل للمحتوى
Robo EgyptRobo Egypt
☰ Course contents
Robo Maker: home
0. Lab tour1
1. The start: the Arduino6
2. Wiring and the traffic light4
3. Inputs: the button4
4. Sound and movement5
5. Sensors and numbers5
6. Distance, the screen and colours5
7. Motors and the car4
8. The project: the city's smart gate3
9. From blocks to C++ code5
10. Sensors and screens in code5
11. Smart systems5
12. Bluetooth: control from the phone1

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.

🧩 The traffic light
Blocks: loop — repeats forever
🖥️ 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.

🧩 A traffic light with different times
Blocks: loop — repeats forever
Green
Green
Yellow
Yellow
Red
Red
✍️ Practise
Build the traffic light.
✍️ Practise here in the lessonor open the lab in a new page ↗

🎯 Challenge yourself

Easy

Night mode: only the yellow blinks.

👀 Show the solution
🧩 Solution
Blocks: loop — repeats forever
In the lab
In the lab

Result: the yellow blinks.

Medium

A pedestrian light: only red and green, taking turns every second.

👀 Show the solution
🧩 Solution
Blocks: loop — repeats forever
In the lab
In the lab

Result: red, then green.

Hard

Before the red, the yellow blinks 3 times as a warning.

👀 Show the solution
🧩 Solution
Blocks: loop — repeats forever
In the lab
In the lab

Result: green, then blinking yellow, then red.

Finished the lesson? Mark it so your progress counts.