Difference: ExerciseSheets (7 vs. 8)

Revision 82022-10-20 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="ASP2022"

Exercises

Line: 64 to 67
 

End of the second exercise session

Added:
>
>

Third exercise session

 

Programming the user LED on the CPU card

Write a program that blinks the user programmable LED on the CPU card at a frequency of 1 Hz (500 ms on, 500 ms off)

Line: 81 to 86
 Improve the program printing the state only when there was a state change.

Added:
>
>

Forth exercise session

 

Reading an analogue signal level from the slider potentiometer

Line: 105 to 111
 
  • magenta
  • red
  • the middle LED becomes white
Added:
>
>
#smallProject

A small project

As a small project, we are going to combine the reading of the ADC and the control of the rgb LED ring. As we saw, the ADC delivers values between 0 and 4095 (12 bits). We can divide this range in 7 slices, corresponding to the 7 LEDs in the ring. For the lowest slice, the top LED will be lit. Then we go clockwise around the ring: the next LED lit will be to the right of the first one. For the highest slice, the middle LED will be lit.

Very often, the color indicates the signal level: For low signal levels, we use "cold" colors (blue, cyan) for higher levels we use "hot" colors (magenta, red, white). The color for the top LED will therefore be blue, the color for the middle LED will be white.

Here is the color sequence:

LED number color
1 blue
2 cyan
3 green
4 yellow
5 magenta
6 red
0 white
Read the slider value from the ADC, subdivide it into 7 slices and light the LED corresponding to the slide into which the ADC value falls. Use the color from the color table.
  -- Uli Raich - 2022-10-14
 
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