s2811 pixel "array" question

Hi: i'm pretty new to programming but am learning quickly. I have 300led ws2811 strip links to an arduino. All working fine and am experimenting with moving meds back and forth.

What i would like to do is set sequences on different parts of the strip. I guess a simple start would be to have the first 30 meds flashing on and off red, the next 30 flashing on and off blue etc...

I want to do this with some kind of flexibility rather than coding in led numbers one by one.

i think i need to set up arrays but despite lots of googling i can't find anything. I can find some guidance for cutting the strips up and using separate pins but I'm not sure i want to do this yet....

hope someone can point me in the right direction


I think you will find that the code you are presently using to control the LEDs is already based on an array it sets up in RAM.

You do not use that array directly, but as you issue the instructions to control individual LEDs, those particular entries in the array are written, then when you call for a display update, the whole array is shifted out to the chain.

So what you do is not to replicate the array, but simply write code loops which perform the necessary operations on parts of that array according to the index range in the loop.

Now these LEDs hold the hue set using internal PWM, but defining a flashing procedure is too much of an ask, so your code must do that by repeated modification of the strip. That is a matter of arranging your code to perform different functions dependent on the values of millis() it reads each time it traverses the main loop(). Do not fall into the trap of thinking you can use "delay()".