Same strip in multiple arrays?

Same strip in multiple arrays?
I would like to have strip a,b and c mirror each other during one function and than have them as one arrays to treat them as one strip for a pattern in another function. When I try build two different arrays including the same strip, it locks up the microprocessor.
I have looked into controllers[1]>showLeds or FastLED.addleds to try and use them as needed, but I can’t seem to call more than one strip at a time (was hoping to combine something like controllers[1,2,3]>showLeds.
I have tried building arrays right before each function, but I can’t find a way to tear down the old array. Fastled.clear didn’t do the trick and not sure if CLEDController init() would work each time I want to rebuild or even how to use it. Any help would be appreciated :slight_smile:

Set it up so all three are treated as one big array.
Then when you want to do your mirroring pattern, instead of using NUM_LEDS (for everything), use NUM_LEDS1 (or whatever you want to call it), that you’ve defined as just the number of leds in the first 1/3 of the whole big array.
Then copy that data to the other “two sections” before displaying.

for (uint8_t i=0; i < NUM_LEDS1; i++) {

//do something to assign colors to the pixels
leds[i] = CHSV(random8(); 255, 255);

//copy data from first section to second section
leds[ i + NUM_LEDS1 ] = leds[i];

//copy data from first section to third section
leds[ i + (2*NUM_LEDS1) ] = leds[i];

The above assumes the three sections all have the same number of pixels. If they are different you will need to put some checks/if statements in there to handle cases where pixels might not exist when doing the coping. Because writing data to pixels that do not exist causes bad things to happen.

@marmil thank you very much for the response. I have tried something like that but I will give that another shot with some of your suggestions! I will post back and let you know, thanks again!

Post your code to and share the link if you run into troubles.

@marmil ​’s suggestion is a great way to do this. The other way is to define the strips as a CRGBArray. This makes it very easy to split the strip into three virtual arrays which are very easy to copy from one to another.

I’m on my phone so it’s hard to post a link, but search this forum for how to do this.

@Jeremy_Spencer thank you, I appreciate the response! I will look into it and share what I
get done :slight_smile:

Just post the exact same question please report back your findings :slight_smile: