Difference: ExerciseSheets (11 vs. 12)

Revision 122022-10-24 - UliRaich

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

Exercises

Line: 81 to 84
  tp_10 is the trajectory for 10 degrees.
Changed:
<
<
tp_45 is the trajectories for 45 degrees.
>
>
tp_45 is the trajectory for 45 degrees.
 

End of the second exercise session

Line: 91 to 94
 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)

Write a function that blinks the LED once with a delay that is passed as a parameter:

Added:
>
>
 
def blink_once(delay): 
Changed:
<
<
Test the function with a main program calling is with different delays.
>
>
Test the function with a main program calling it with different delays.
  Use the function to implement a program that blinks an SOS: 3 short pulses, followed by 3 long pulses, followed by 3 short pulses, followed by a 2s pause. You may use a 200 ms delay for the short pulses and 700 ms delay for the long ones.

Reading the pushbutton

Line: 102 to 106
  Improve the program printing the state only when there was a state change.
Changed:
<
<
>
>
 

Forth exercise session

Reading an analogue signal level from the slider potentiometer

  • Read the documentation of the ADC driver in the MicroPython manual
Line: 120 to 124
  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.
Changed:
<
<
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
#smallProject
>
>
You may have a look at the small project below and light the LEDs in the colors required by the project.

 

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.

Line: 158 to 156
 
META FILEATTACHMENT attachment="helloWorld.png" attr="" comment="" date="1665842121" name="helloWorld.png" path="helloWorld.png" size="73165" user="UliRaich" version="1"
META FILEATTACHMENT attachment="gnuplot_sin.png" attr="" comment="" date="1665866878" name="gnuplot_sin.png" path="gnuplot_sin.png" size="30601" user="UliRaich" version="1"
Changed:
<
<
META FILEATTACHMENT attachment="exercises.odt" attr="" comment="" date="1666269925" name="exercises.odt" path="exercises.odt" size="147725" user="UliRaich" version="1"
>
>
META FILEATTACHMENT attachment="exercises.odt" attr="" comment="" date="1666623199" name="exercises.odt" path="exercises.odt" size="210099" user="UliRaich" version="2"
 
META FILEATTACHMENT attachment="trajectories.png" attr="" comment="" date="1666445815" name="trajectories.png" path="trajectories.png" size="58903" user="UliRaich" version="1"
 
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