I need a certain palette of colors (about 6 pixels GREEN, 3 pixels YELLOW,

I need a certain palette of colors (about 6 pixels GREEN, 3 pixels YELLOW, 2 pixel BLUE) travel up and down an already RED lit strip.

Checking out Kriegsman’s updated “sinelon” with no visual gaps and wondering if there is any way this can be modified to traverse this pattern down a red strip?

Anyone have any pointers on how to achieve this animation? Using Apa102’s with Mega and WS2812s with Nano.

Create your palette array, then loop through it and replace any black color set with your red…

If you’re just looking to move a simple pattern along the string here’s a quick solution.

@marmil thank you Marc this worked great! but if you have time I had two issues I couldnt solve after a nights work: - I have been trying to move " fill_solid( base, NUM_LEDS, CRGB::Red); // base color" anywhere other than setup so I can use this with other code using a rotary encoder. Is it possible to use fill the red outside setup? Also if I wanted the pattern to generate before first one reaches the end (In other words at some point there would be 2 or 3 patterns moving across the strip.) what should I do?

Yes, instead of filling and setting up your pattern in the setup section, you could move that part into a function. Then that function can be called from setup, or at any other time from the main loop. You could even change/update what’s in the base CRGB array based upon a variable when you call the function, or have different functions and change which one you call to update base.

Here’s an example (see line 45) where I called a function in startup that did some stuff with the LEDs. This startupLEDsTest() function could also be called at anytime during the main loop too. You can do something like this for setting up your custom pattern.

And here’s a variety of other programs you can explore to give you some more ideas to try out.

If you get stuck on something you can put your code on http://gist.github.com and share the link. (For a number of reasons please don’t post code here in G+)

had to do it as such in the end: https://gist.github.com/nervusvagus/a5e38866606781491074c2f02c6af853 two issues I have with it is that, one it is memory intensive (for nano at least) and also I couldnt find a way other than adding array members one by one to create the extra pattern sliding through the strip :-0

Glad you have it working. Or is it working??

A few things I noticed…
Because your NUM_LEDS is more then 255, the pos variable should be uint16_t (instead of uint8_t).

Similarly, for the for loop on line 73, it would need to be uint16_t.

After line 81 I think you’ll need to add a check to make sure pos isn’t going above the value of NUM_LEDS. Something like:
pos = pos + delta;
if (pos == NUM_LEDS) { pos = 0; } //reset

mod8 is only for values up to 255. Instead of mod8 you can change line 75 to use modulo:
leds[ (pos + delta + i) % NUM_LEDS ] = base[i];

Also, looks like you missed setting a base[92] if that matters.

Yes, by having the second array CRGB base, the memory needed is increased. If the pattern you want to slide down your strip only goes up to base[110] though, instead of CRGB base[NUM_LEDS], you could have CRGB base[111] and save some memory there.

I also occurred to me that you might check out FastLED’s gradient palettes since it looks like you’re building a gradient of un-equal widths (or varying anchor points). That might be another option for you if you only need to set it up once and not change it.