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

Section 5: Sensors and numbersLesson 5.4 ยท โฑ 12 min
๐ŸŽฏ Project goal
Blue on 9 and red on 10, and the potentiometer on A0. When you turn it, the blue gets brighter and the red dimmer at the same time.

Think: blue maps from 0~1023 to 0~255, and red maps to 255~0 (reversed).

๐Ÿ“Œ Another example: an LED for each half

The knob in the first half: red lights up. In the second half: blue.

๐Ÿงฉ An LED for each half
Blocks: loop โ€” repeats forever
The first half: red
The first half: red
The second half: blue
The second half: blue
โœ๏ธ Practise
Build the project.
โœ๏ธ Practise here in the lessonor open the lab in a new page โ†—

๐ŸŽฏ Challenge yourself

Easy

Both LEDs get brighter together with the knob.

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

Result: they get brighter together.

Medium

Blue follows the knob, and red is always on at full strength.

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

Result: red is steady and blue changes.

Hard

Three zones: below 300 red, above 700 blue, and in between both.

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

Result: in the middle both light up.

Finished the lesson? Mark it so your progress counts.