// https://www.reddit.com/r/FastLED/comments/1oczzf8/code_running_in_sequence_not_simultaneously/
#include <FastLED.h>
// Set the length of each strip
CRGBArray<58> StringOne;
CRGBArray<57> StringTwo;
CRGBArray<56> StringThree;
CRGBArray<55> StringFour;
CRGBArray<54> StringFive;
CRGBArray<53> StringSix;
// An array of those strips, for ease of referring to them in loops and things
const CRGBSet strings[] = {StringOne, StringTwo, StringThree, StringFour, StringFive, StringSix};
void setup() {
FastLED.addLeds<NEOPIXEL, 2>(strings[0], strings[0].len);
FastLED.addLeds<NEOPIXEL, 3>(strings[1], strings[1].len);
FastLED.addLeds<NEOPIXEL, 4>(strings[2], strings[2].len);
FastLED.addLeds<NEOPIXEL, 5>(strings[3], strings[3].len);
FastLED.addLeds<NEOPIXEL, 6>(strings[4], strings[4].len);
FastLED.addLeds<NEOPIXEL, 7>(strings[5], strings[5].len);
}
void loop() {
// store the current position of the dot for each strip
static int pos[6];
// draw each strip's dot
for (int strip = 0; strip < 6; strip++) {
strings[strip].leds[pos[strip]] = CRGB::Green;
}
FastLED.delay(40);
// erase the dots
for (int strip = 0; strip < 6; strip++) {
strings[strip].leds[pos[strip]] = CRGB::Black;
// and move each dot to the next position, wrapping at the end of each strip
pos[strip] += 1;
pos[strip] %= strings[strip].len;
}
}