Lite / Building Machines That Respond / Week 25
Week 25: Timing and control sequences
This week you will
- Use a timer and prescaler to count time, and PWM to produce variable power.
- Calculate PWM duty cycle and average voltage.
- Write a non-blocking timing pattern so several tasks share one loop.
Lessons
- Timers: hardware that counts for you · about 30 min
Your loop is busy reading sensors. Who is keeping track of the time? - PWM: dimming with an on/off switch · about 30 min
A pin can only be fully on or fully off. So how does it dim an LED to 30% or run a motor at half speed? - Doing several things at once (without waiting) · about 35 min
Blink an LED every half second, read a sensor ten times a second and never miss a button press. With one CPU and no waiting. How?