Mapping (live) drawnings on the leds with Javascript
How do I show a drawing on a pixel based led strip?
I have already succeeded in mapping text into the led strips. But custom drawings are another story. I can't define in advance which leds should be lit for which drawing because every drawing is different.
I created a simple drawing program with canvas. Each pixel of the drawing is stored in an array. The only thing I had to do was to convert these pixels into the dimension of the Christmas tree. The dimension of the canvas was about 600 by 600. The resolution of the Christmas tree is a piramide shape of 34 by 15.
To make this conversion I created a function that converts the canvas pixels to an two dimentional array with all the leds and their color that need to be for that drawing.
Again, I don't want to connect my leds all the time when I'm testing, so I showed the colored leds in divs for debugging. This was all in Javascipt, I will still need to convert the arrays and logic into C++ code to test it on the leds. That's for a future blog.