Looking for a bit of advice when working with an array of arrays, im using ws2812b leds and ive got 5 individual strips. Id like to ‘reuse’ 3 of them in one big array but only for one switch case. ive had a look into the documentation and it seems as though you have to use entirely separate pins for the different arrays so ive used two different pins for the different arrays but wired them to the same strip. Ive even tried using two transistors per strip to switch between data inputs. But no matter what i do as soon as i switch my cases the leds freeze up and im assuming its because its being sent both sets of data.
So i hoping somebody here has some insight into either a coding fix or a mechanical fix to this problem. Also it could just be totally my fault but all the code works before ive tried to set up this multiple array. Ill only include up the my setup in this post for the length of it but i can provide it all if necessary.
I would try to do this in code for the case where you want the three strips to act as one and not mess with different physical wiring.
For the case where it’s to act as one array, set all the color data in another temp CRGB array that is the size of the sum of the number of pixels in the three strips. And then appropriately copy the data from the temp array to the three separate strips before displaying.
@marmil yeah i think i see what you mean, so rather than combining the 3 existing strips in an array, create one that wont get ‘shown’ and then use memmove to copy the appropriate blocks of leds to each original strip individually?
neat idea, ill give it a go tonight or tomorrow!
The snytax for memmove8 is:
memmove8( &destination[start position], &source[start position], size of pixel data )
So for example, if your source, allLeds, was a total of 24 pixels and it was being split in 3rds, you could move the data for the first 8, middle 8, and last 8 pixels to the three destination strips like this:
//move allLeds pixel data 0-7 to underglow 0-7
memmove8( &underglowLeds[0], &allLeds[0], 8*sizeof(CRGB) );
//move allLeds pixel data 8-15 to featureLeds 0-7
memmove8( &featureLeds[0], &allLeds[8], 8*sizeof(CRGB) );
//move allLeds pixel data 16-23 to caseLeds 0-7
memmove8( &caseLeds[0], &allLeds[16], 8*sizeof(CRGB) );
If memmove8 might be too confusing for others using your code a few simple “for loops” can be much easier to understand and is often still plenty fast.