// 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 strips[] = {StringOne, StringTwo, StringThree, StringFour, StringFive, StringSix};
constexpr uint8_t NUM_STRIPS = sizeof(strips) / sizeof(*strips);
void setup() {
FastLED.addLeds<NEOPIXEL, 2>(strips[0], strips[0].len);
FastLED.addLeds<NEOPIXEL, 3>(strips[1], strips[1].len);
FastLED.addLeds<NEOPIXEL, 4>(strips[2], strips[2].len);
FastLED.addLeds<NEOPIXEL, 5>(strips[3], strips[3].len);
FastLED.addLeds<NEOPIXEL, 6>(strips[4], strips[4].len);
FastLED.addLeds<NEOPIXEL, 7>(strips[5], strips[5].len);
}
void loop() {
// store the current position of the dot for each strip
static int pos[NUM_STRIPS];
// draw each strip's dot
int count = 0;
for (auto &strip: strips) {
strip.leds[pos[count++]] = CRGB::Green;
}
// Send the framebuffer to the LEDs
FastLED.show();
// for each strip…
count = 0;
for (auto &strip: strips) {
// …dim every pixel of this strip
strip.fadeToBlackBy(21);
// and for each pixel on the current strip…
for (auto &pixel: strip) {
// …add obvious random noise to very dim pixels…
if (pixel.green < 16)
pixel.green += random8(16);
// …and add more subtle noise to mid-brightness pixels
else if (pixel.green < 96)
pixel.green += random8(6);
}
// move this dot to the next position and wrap at the end of this strip
if (++pos[count] == strip.len)
pos[count] = 0;
count++;
}
}