Knight rider. We program smooth animation on the microcontroller
Good day.
Today I want to tell you how to make a smooth animation on the microcontroller using LEDs. The basis is taken from Atmel's attiny2313 microcircuit, which was exactly what I found. I will not go into the details of the firmware, the programmer, it was all in the middle. Here and under Linux
Most people remember the movie, and then the series “Knight Rider” . Who in childhood did not dream of such a car? Well, for example, I decided to make an animation, such as in front of the car itself. ')
Soldered circuit according to the following principle.
The bar with LEDs took from the TV "Electron", just there were 8 pieces. There were 3 volt LEDs, so in my version, in series with diodes, I added 200 ohm resistors.
Theory
A trivial thing, if you write a unit to the output port, then the diode will shine, if zero, it goes out. In order for it to be partially luminous (luminaries, but not at full power), it is necessary to emulate PWM on each port.
The accuracy of the formation of the pulse decided to spread by 10 iterations. That is, perhaps 10 different options for the power of the diode. If all the iterations at the output will be 1, then this is the maximum luminescence, if 5 out of 10 - to turn out half. That is, when at output 1 it will light up, but 0 goes further, and it dies away. Such a PWM signal has a few hundred kilohertz, and the inertia of the diode itself gives us the desired effect.
Implementation
I put the whole animation into the matrix, it gives us the opportunity to easily and easily program the animation itself.