Question about multiple arrays on one strip...I think Hi,

Question about multiple arrays on one strip…I think

Hi, I’m a bit stuck and would appreciate any help you can give. I have a strip of 62 leds that I am using to illuminate some figures from the top and bottom. I want to group 6 leds at a time and

a) set a group of 6 leds at once as a group
b) do something nicer than setting each group a single colour.

At the moment I am adding the leds as standard then setting one to a colour, setting the other 5 to the value of the first and then showing.

This results in ugly/long code - I’m sure there must be a more efficient way. Can I define each group of leds once and then address/write to them or a group of groups at once ?

My code (very much wip and not finished) is here…

http://pastebin.com/5730fE6w

Any pointers would be gratefully accepted.

CRGBArray should help.

Define your leds like this
CRGBArray<NUM_LEDS> leds;

Then you can set colours like this:

leds(5,9)=CRGB(valR,valG,valB);

But, if you need the band of colour to loop round the end of the strip, do it like this:

for(i=0,i<bandLength,i++){
leds[addmod8(startPostion,i, NUM_LEDS-1)] = CRGB(valR,valG,valB);
}

I’ver not tested the code, but hopefully it’ll work

@David_Stewart1 - Take a look at these two examples:

and

I think they will provide you with the information that you are looking for.

Hi Jeremy and Ken, thanks to you both for taking the time to reply. I’m off to check out the links you have posted. I’ll post back here when I have made some progress.