//Example solution for this reddit question:
// https://www.reddit.com/r/FastLED/comments/1hf1h1r/revere_strip_with_fastled/
//
#include "FastLED.h"
#define NUM_STRIPS 3
#define NUM_LEDS_PER_STRIP_50 50
#define NUM_LEDS_PER_STRIP_100 100
#define NUM_LEDS NUM_LEDS_PER_STRIP_50 + NUM_LEDS_PER_STRIP_100 + NUM_LEDS_PER_STRIP_50
CRGB leds[NUM_LEDS];
// Add a second array which will be the displayed array. The leds array will only be where things are calculated.
CRGB display[NUM_LEDS];
uint8_t patternCounter = 0;
bool isRunning = false;
#define SPARKLE_AMOUNT 30
#define SPARKLEBOMB_AMOUNT 10
#define FADEOUT_SPEED 40
#define GLITTER_AMOUNT 60
uint8_t gHue = 0;
uint8_t GLOBAL_BRIGHTNESS = 125;
uint8_t fps = 60;
uint8_t index = 0; //-LED INDEX (0 to LED_COUNT-1)
#include "MyFunctions.h"
MyFunctions func;
void setup() {
//Specify the CRGB display array to be sent out to the physical pixels.
// tell FastLED there's 100 WS2811 leds on pin 3, starting at index 0 in the led array
FastLED.addLeds<WS2811, 3>(display, 0,NUM_LEDS_PER_STRIP_50);
// tell FastLED there's 100 WS2811 leds on pin 4, starting at index 60 in the led array
FastLED.addLeds<WS2811, 4>(display, NUM_LEDS_PER_STRIP_50, NUM_LEDS_PER_STRIP_100);
// tell FastLED there's 60 NEOPIXEL leds on pin 5, starting at index 120 in the led array
FastLED.addLeds<WS2811, 5>(display, NUM_LEDS_PER_STRIP_50 + NUM_LEDS_PER_STRIP_100, NUM_LEDS_PER_STRIP_50);
}
void loop() {
fadeToBlackBy(leds, NUM_LEDS,5);
uint8_t beat1 = beatsin16(5, 0 , NUM_LEDS-1);
uint8_t beat2 = beatsin16(5, 0 , NUM_LEDS-1,0,65535/2);
leds[beat1] = CRGB::White;
leds[beat2] = CRGB::Red;
// Before calling show(), copy all pixel data from leds to display array, and reverse order on first strip.
for (uint16_t i = 0; i < NUM_LEDS; i++) {
if (i < NUM_LEDS_PER_STRIP_50) {
display[NUM_LEDS_PER_STRIP_50 - 1 - i] = leds[i];
} else {
display[i] = leds[i];
}
}
FastLED.show();
}