ุงู†ุชู‚ู„ ู„ู„ู…ุญุชูˆู‰
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: the coloured parking sensor

Section 6: Distance, the screen and coloursLesson 6.4 ยท โฑ 15 min
๐ŸŽฏ Project goal
Closer than 15 cm: red and the buzzer rings. Closer than 40 cm: yellow with no buzzer. Otherwise: green.

We need three cases, so we put an if inside the else: if closer than 15 โ€ฆ else if closer than 40 โ€ฆ else โ€ฆ

๐Ÿงฉ A possible solution
Blocks: loop โ€” repeats forever

๐Ÿ“Œ Another example: parking with sound too

Very close (below 15): red and beeping. Medium (below 40): yellow. Far: green.

๐Ÿงฉ Parking with sound too
Blocks: loop โ€” repeats forever
Far: green
Far: green
Medium: yellow
Medium: yellow
Very close: red and beeping
Very close: red and beeping
โœ๏ธ Practise
Build the parking sensor.
โœ๏ธ Practise here in the lessonor open the lab in a new page โ†—

๐ŸŽฏ Challenge yourself

Easy

Only two colours: green when far (30 or more), and red when close.

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

Result: green, then red.

Medium

Close: the red LED blinks.

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

Result: red blinking.

Hard

Very close (below 10): the buzzer beeps without stopping.

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

Result: non-stop beeping.

Finished the lesson? Mark it so your progress counts.