๐ ๏ธ 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.



โ๏ธ Practise
Build the project.
โ๏ธ Practise here in the lessonโ Close the labor open the lab in a new page โ
๐ฏ Challenge yourself
Easy
Both LEDs get brighter together with the knob.
๐ Show the solution๐ Hide the solution


Result: they get brighter together.
Medium
Blue follows the knob, and red is always on at full strength.
๐ Show the solution๐ Hide the solution


Result: red is steady and blue changes.
Hard
Three zones: below 300 red, above 700 blue, and in between both.
๐ Show the solution๐ Hide the solution


Result: in the middle both light up.

