I'm working on a sketch where I've defined 6 arrays on an LED strip.

I’m working on a sketch where I’ve defined 6 arrays on an LED strip. I want to be able to have each named array fade from a starting color to a new defined color.

For example:
myLEDs1[ ] start Red and fade to Magenta.

I’m having a difficult time finding an example sketch that I can use as a template. Any help would be appreciated.
https://gist.github.com/anonymous/2a826b1f627575f5e13685311a27fd25

You have NUM_LEDS set to 240 so your for loop will count up 239, but your arrays do not have 240 elements each. You’ll need to get that sorted out before going further. You might need separate for loops if all the arrays don’t have the same number of elements.

Yes, some of the LEDs on the strip are not being lit. Should I include them in their own array? To this point I was ignoring them. Or can I simply adjust the NUM_LEDS to reflect the total amount in the current arrays?

The unlit pixels don’t need to be in their own array, but if they are it could give you another option. You could then light up everything without initially worrying about what should be off. And then run an additional function that turns off the pixels you don’t want lit just before calling show(). Sometimes it’s easier to code this way depending on what you’re doing.

When using something like leds[myLEDs1[i] ] you need to be careful to loop through the correct number of elements the array has. Also, if you accidentally try to address a pixel number that doesn’t exist it can cause bad things to happen (overwrites bits of memory on your controller and can cause your program to lock up or your display to go all wacky). For example, your last number in myLEDs6 is 240. That pixel doesn’t exist since your NUM_LEDS is 240, therefore the last pixel you can address is leds[239].

To make it easier to get the correct number of elements in an array without needing to manually count them you can do something like this:

int myLEDs1[ ] = { 6,8,10,18,19,20 };
uint8_t size1 = sizeof(myLEDs1)/sizeof(myLEDs1[0]);

This also makes it very easy to add/remove elements in the array and have size1 automatically update.

And then in your main loop a for loop could use size1:

for (uint8_t i=0; i<size1; i++) {
leds[ myLEDs1[i] ] = CRGB::White;
}

NUM_LEDS should be your actual pixel count (or it could be a number larger then your actual pixel count, but you wouldn’t want it smaller in your setup.)

OK, I think I’ve cleaned up the arrays. I’m now working on getting all the leds in each array to start at a unique pre-defined color and slowly fade into a uniqe target color and continuously loop. There doesn’t seem to be an existing template that I can work from. any direction you can point me in?

Here’s one possible way.

And not exactly what you’re looking for but might give you some ideas.

@marmil Your blend_to_target sketch is almost perfect for me. Is it possible to have the colorTarget loop back to the colorStart, rather than moving on to a random color?
eg start at red blend to yellow and go back to red.

And finally how do I set this up for each one of my arrays? The colors are seemingly set in the header of the sketch.

thank you for your patience.

I would probably use a bool variable to toggle back and forth between your two colors.
https://www.arduino.cc/reference/en/language/variables/data-types/bool/

bool blendUp = true;

if (blendUp) {
//set target to colorB
blendUp = !blendUp; //toggle
} else {
//set target to colorA
blendUp = !blendUp; //toggle
}

If all the strips are going to be different then you’ll probably need to make additional variables for the other colors. Get the transitioning/looping back and forth part working first, then move on to expanding the number of colors.

Marc
I got the blend to color to work for the entire strip (1 array). I’m now trying to incorporate it into my sketch of multiple arrays but its returning the following error:
invalid types ‘CRGB [240][int [32]]’ for array subscript
at the fill_solid commands.

Can you post your code to http://gist.github.com and share the link here?

The first argument that fill_solid wants is a CRGB array, but you’re feeding it myLEDs1, which is not a CRGB array, just a regular array.

Instead of fill_solid, use a for loop to loop over your myLEDs1 pixels and fill them with colorCurrent1.

[Oh and sorry, I just spaced and missed that you DID include a link to your code in your previous post.]

Marc,
I can’t seem to change the blendRate, no matter what value I give it.