Tags:
create new tag
view all tags

A small project

In this small project, we want to read the analogue sensor (slider) and display the result on the rgb LED ring. To do this, we will divide the possible slider values into 7 slices and light an LED depending on the slice into which the value falls. Since we can get values between 0 and 4096 the first slice will be 0 .. 585 (4096 / 7). If we do this, the highest slice will be 3510 .. 4095.

First, print the led number for the signal level read from the slider. Move the slider and make sure that you get the correct LED number.

Then light the LED you found with a single color, e,g, red.

Signal levels are often represented in colors, where "cold" colors represent low values and "hot" colors represent high values.

We can then attribute a different color to each LED, as the lighting of the LED depends on the signal level reached. We only use the basic colors:

  • blue
  • cyan
  • green
  • yellow
  • magenta
  • red
  • white
The top LED (lowest signal level) will therefore have the color blue, while the middle LED (highest signal level) will become white.

Light the LED with the color corresponding to the signal level.

Here is the exercise description: ExerciseSheets#SmallProject

-- Uli Raich - 2022-10-17

Comments

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2022-10-24 - UliRaich
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback