ุงู†ุชู‚ู„ ู„ู„ู…ุญุชูˆู‰
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

๐Ÿ› ๏ธ Section project: fix the traffic light

Section 2: Wiring and the traffic lightLesson 2.3 ยท โฑ 10 min
๐ŸŽฏ Project goal
The traffic light program has 3 hidden mistakes. Find them and fix them, as engineers do.
  • Run the program and watch: which LED behaves wrongly?
  • Read the blocks line by line: is the pin number right? Are HIGH and LOW in their places? Is there a delay after every colour?

๐Ÿ“Œ Another example: the correct traffic light

After fixing the mistakes: each LED lights alone, in the right order.

๐Ÿงฉ The correct traffic light
Blocks: loop โ€” repeats forever
The traffic light works
The traffic light works
โœ๏ธ Practise
Fix the three mistakes.
โœ๏ธ Practise here in the lessonor open the lab in a new page โ†—
โœ๏ธ Practise
Extra challenge: make the yellow blink 3 times before the red.
โœ๏ธ Practise here in the lessonor open the lab in a new page โ†—

๐ŸŽฏ Challenge yourself

Easy

The mistake: green is on pin 10 instead of 11. Fix it.

๐Ÿ‘€ Show the solution
๐Ÿงฉ Solution
Blocks: loop โ€” repeats forever
In the lab
In the lab

Result: the green lights on 11.

Medium

The mistake: the red never goes off (we forgot LOW). Fix it.

๐Ÿ‘€ Show the solution
๐Ÿงฉ Solution
Blocks: loop โ€” repeats forever
In the lab
In the lab

Result: the red goes off before the green.

Hard

The mistake: there is no wait after the yellow, so we don't see it. Fix it.

๐Ÿ‘€ Show the solution
๐Ÿงฉ Solution
Blocks: loop โ€” repeats forever
In the lab
In the lab

Result: the yellow shows for 0.8 seconds.

Finished the lesson? Mark it so your progress counts.