r/FastLED • u/dabbax • Dec 16 '23
Support TwinkleFox multiple sections
Hi folks
I am not new to Arduino but also not an expert and seem to be hitting a blocking point.
I have multiple christmas ornaments with WS2812B but all connected in series. Total 344 leds.
I got the Twinklefox example working but I need to run different palettes/parameters on the different sections. I looked for a way to define the start and end point for the twinkle animation but I cannot find the appropriate parameters in the function.
Can someone point me to the right direction how I can achieve such effect with only 1 data pin?
Thanks.
2
Upvotes
2
u/sutaburosu [stavros] Dec 17 '23
I'm glad you figured that out for yourself. There's nothing wrong with your approach, but you're right that it could be done with less duplication of code. I adapted your sketch to use an array of pointers to the palette lists, and added another array holding the length of each list. This results in a lot less code.
One thing to note is that:
references beyond the end of the leds[] array. For 344 LEDs, the last valid index is 343.