If you are looking for a fun LED project why not try your hand at building a Larsen Scanner. You might not recognize the name but you have seen them before. Remember the sweeping lights on the front of the Knight Rider car called Kitt? The project will take you through the process step by step and has all the details you need to make your own.
“In order to get the fading effect I need to use Pulse-Width Modulation. This is a fancy way of saying that we need to turn the LEDs on and off very fast. The percentage of on and off time account for different levels of brightness. I’m going to use an internal timer for this. Here’s how I plan to make it work:
- Timer overflows and Interrupt Service Routine starts
- All outputs are updated from buffer set during the last interrupt
- Software counter is incremented.
- Buffer is set for next interrupt by comparing the software counter to each LED’s PWM value. If the counter is higher than that value, the LED should be off, otherwise it should be on.”