I’m just getting into using multiple strips at the same time and was wondering what would be the best way to create the LED arrays. I have 5 rings of 24 LEDs and would like to mirror the rings but at other times would like to not mirror the rings and say have a rainbow spread evenly throughout all of the rings.
Should I wire the rings together and address each ring using CRGBSet or should I stick with using multiple outputs? Which way would produce cleaner looking code? Any suggestions are appreciated.
I don’t know about cleaner code… I’m not sure I would ever describe my code as clean.
But after recent adventures, I personally would have the strips kept separate, and then having “custom” arrays for mirrored.
I prefer one big array as described here: https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples#one-array-many-strips.
In case you need to mirror stuff you can memcpy8 these parts within the array.
@Stefan_Petrick Do you have a good example of how you are using memcpy8? I understand the concept of how it works but don’t have a grasp on how to properly execute it to be useful.
Sure, in general it´s void * memcpy8 ( void * dst, const void* src, uint16_t num )
Example - let´s say you have rendered your led data into index 0-23 from the CRGB array called “leds” . Now you want to copy this data to index 24-47 (mirror it to the next ring):
memcpy8(leds + 24, leds, 24*3);
That´s all.
@Stefan_Petrick Very cool, thank you. Would this be more efficient than doing leds(24,47) = leds(0,23) or is that pretty much the same thing and FastLED just handles the memcpy8 stuff in the background?
Usually you want to do this with a bunch of leds - you need an extra loop then. memcpy8 is way faster (!) to execute and easy to read and understand within the code. So it runs not “in the background” but it´s REALLY fast.