Difference: ExerciseSheets (6 vs. 7)

Revision 72022-10-17 - UliRaich

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

Exercises

Line: 84 to 80
  Improve the program printing the state only when there was a state change.
Changed:
<
<
# Session 4
>
>
 

Reading an analogue signal level from the slider potentiometer

Added:
>
>
  • Read the documentation of the ADC driver in the MicroPython manual
  • Connect the potentiometer to the triple base according to the table in Analogue Signals#PotConnections
  • Create an ADC object and make sure you set the attenuator to 11 dB
  • Read the slider value every 100 ms and print its raw 12 bit value and print it.
  • Move the slider and observe the changes in the value

Controlling the rgb LED ring

The LED ring consists of 7 WS2812B addressable and cascadable LEDs. Each rgb LED consists of 3 tiny single color LEDs emitting red, green and blue light. The color you finally see is the mixture between these color components. The MicroPython driver for this type of LED is called NeoPixel. The color is defined as a tuple with three 8 bit color component intensities. 8 bits means that you can have values in the range 0..255. Since the LEDs are extremely bright, please restrict the values to 0..31.

Write a program trying to find out to which LED an LED number corresponds to. Where on the LED ring is LED0, LED1 ... Do this by lighting the LEDs one by one with only the red color component switched on. The green and blue are set to zero.

Then change the color. Try all color combinations (31,0,0), (0,31,0), (0,0,31) but also (31,31,0), (31,0,31) ... Which colors do you get?

You can further modify the colors by changing the intensity values. For example: (12,27,5) Play around trying to generate as many different colors as you like.

Write a program that lights the top LED in blue and then lights the following LEDs in clockwise direction to :

  • blue (top LED)
  • cyan
  • green
  • yell low
  • magenta
  • red
  • the middle LED becomes white
 
Changed:
<
<
-- [[Main.U][ U liRaich -

2022-10-14]]

>
>
-- Uli Raich - 2022-10-14
 

Comments

 
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