A couple of days ago I blogged about the LED Picture Frame I built, which runs different animations and serves as a decorative element in our home.
Having gotten into some Christmas spirit, I felt that this picture frame needed exactly that and wrote a simple Christmas tree with blinking lights animation.
To save me some time and effort when creating these RGB LED matrix animations, I wrote a little web application that lets me do exactly this.
This design application is part of a bigger project consisting of a couple of modules that serve as a family information system / dashboard. The module you might want to look at for this purpose is the draw module.
The magenta pixels represent those places where we want the actual blinking lights animation to happen. We will handle this in the Arduino source code later.
The aforementioned web application also provides a code export feature that generates the necessary C/C++ code for the Arduino project LedMatrix which drives the actual LED matrix frame.
After the static initialization of the world matrix, the Arduino code saves those magic magenta pixels that in a separate mask matrix.
Then in the simulate method, which gets repeatedly called, we just update those pixels we remembered in the mask matrix with a random selection of colors.
Check out the full source code for this animation (and the rest of them) on GitHub.