could anyone spit out a chunk of code that would make blocks of 7 leds rotate on a strip of 70. so it would be 10 chunks of 7 and they would all advance one space at a time basically to give the appearance of movement. I just having a hard time visualizing how to do it. And please if it is too hard to do or time consuming don’t bother.
Hi Josh, have you looked at the Cylon example code? I think that code will give you a place to start. Also, @Mark_Kriegsman posted an Anti-aliasing example that shows how to advance lights across the led strip with the LEDs fading in and out.
Go here too! I learned a lot from porting/experimenting with the examples provided. The funkboxing guy helped me in the past and always answered my questions regarding his code.
One method is to ignore everything and only deal with just the first or last LED on the string. Keep a counter that’s going to determine whether it needs to be on or off, the rest of the time you’re just moving the string forward or backwards.
Let’s assume you want to deal with the first LED only, so leds[0], you can advance the string with a simple loop:
for (int px = NUM_LEDS - 1; px > 0; px–) {
leds[px] = leds[px - 1];
}
Now all you have to do is deal with the first LED only, whether it’s on, off, red, green, or whatever you want to do. When you push the string it passes the LED values to the next one.