#include <FastLED.h>
#define NUM_LEDS 16 // number of LEDs in the strip
#define NUM_LEDS2 16 // number of LEDs in the strip
#define DATA_PIN 6 // pin to connect the data line of the strip
#define DATA_PIN2 7 // pin to connect the data line of the strip
#define BRIGHTNESS 255 // maximum brightness of the LEDs
CRGB leds[NUM_LEDS+NUM_LEDS2]; // array to store the LED colors
//CRGB leds2[NUM_LEDS2]; // array to store the LED colors
unsigned int iteration = 0;
unsigned long lastIteration = 0;
unsigned int cycle = 0;
unsigned int manipulateLEDs;
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS); // initialize the LED strip
FastLED.addLeds<WS2812B, DATA_PIN2, GRB>(leds, NUM_LEDS, NUM_LEDS2); // initialize the LED strip
FastLED.setBrightness(BRIGHTNESS); // set the brightness
manipulateLEDs = NUM_LEDS + NUM_LEDS2;
}
void loop() {
if (millis() - lastIteration >= 10) {
//changeLED(iteration++, 255, 0, 0);
leds[iteration++].setRGB(255, 0, 0);
if (iteration > 1) leds[iteration - 2].setRGB(0, 0, 0); //changeLED(iteration - 2, 0, 0, 0);
if (iteration >= manipulateLEDs - cycle) {
iteration = 0;
cycle++;
if (cycle == manipulateLEDs) {
cycle = 0;
manipulateLEDs = NUM_LEDS + 1;
for (int i = 0; i < NUM_LEDS; i++)
leds[iteration++].setRGB(0, 0, 0);
//FastLED.clear();
FastLED.show();
}
}
FastLED.show();
lastIteration = millis();
}
}
/*void changeLED(int number, int red, int green, int blue) {
if (number < NUM_LEDS) {
leds[number].setRGB(red, green, blue);
} else {
leds2[number - NUM_LEDS].setRGB(red, green, blue);
}
}
union AllLEDs
{
struct {
CRGB one[NUM_LEDS];
CRGB two[NUM_LEDS2];
}ledstrip;
CRGB virtualLeds[NUM_LEDS+NUM_LEDS2];
} allLEDs; */