Hello, I finally have the time to complete my Xmas tree. Still have quite a lot of assembly to do but should complete within a few days now.
I am trying to think ahead (not very successfully, as HW assembly keeps me too busy) to the point I will start programming the tree animations.
I included a short video that shows a simple pixel test animation on a branch sequentially lighting LED_0 through LED _12 to show how each branch is wired.
My tree will have 28 branches ending with an identical trident shape but the branches vary in length. My longest branches at the bottom have 13 LEDS and near the top, the shortest branches (with trident shapes) have 7 LEDS. At the very top of the tree, I have 4 single branches (no tridents) with 4 LEDS, a top central branch with 5 LEDS that holds a star with 11 LEDs.
Each branch and star (total of 34) gets its data from a unique pin on my Arduino MEGA (So 34 digital pins are used). I am using the latest release of FASTLED. My LEDs are all WS2811 pixels with 8mm diffused LEDS.
I am not a programmer but I know I will manage by myself to get nice animations going but wonder if any of you can recommend the best, most efficient way to manipulate the LED data. Specifically how to define LED arrays to simplify coding the animations considering that this is not simple 2D matrix but a weird 3D shape.
Any great ideas about special animations are welcome !
The project I just finished (a snowflake) has something similar to what you’re doing, except that each “arm” is identical. That certainly made it easier to define an array to address the pixels. With the high degree of variance in your pixel “lengths”, it would be wasteful to define a a single, two dimensional array.
What you could do is define a one dimensional CRGB array that you would fill with the light values, and a two dimensional byte array (presuming your total number of leds is under 256) that defined the number of lights in each of the branches and their offset into the CRGB array for logic control.
What I did, in order to be able to light the “trident” arm lights synchronously with the main branch lights, was to define a two dimensional array with three values: the main branch light offset, the lefthand arm light offset, and the righthand arm offset.
If you want some code to “borrow” (as I did… liberally), here is the code from my project: http://pastebin.com/y627as5t#
It’s a hodge-podge of fill methods, as I was running out of time and had to just say “good enough for this year”. The comments are woefully lacking where the original code is mine.
Hi @P_Routon
My tree will have a total of 332 LEDs. Thanks for the hints. I will certainly dig through existing code when I complete my assembly in a few days !
Well in that case you’ll have to use a full integer array for the offset value, and in the routines. I used a lot of single byte variables because I could, and was trying to keep it as small as possible. Since you’re using a Mega, you’re not tight on RAM. I’m running on an Uno.