#include <Adafruit_NeoPixel.h>
#define NUM_LEDS 70
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.setBrightness(50);
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
animate(20);
}
// Slightly different, this makes the rainbow equally distributed throughout
void animate(uint8_t wait) {
static uint16_t start = 0;
strip.fill(0, 0,NUM_LEDS/2); // erase the first half
// fill up that half strip
for (int32_t i = NUM_LEDS / 2-start; i >=0; i--) {
strip.setPixelColor(i, 0xFF0000); // red
}
// now mirror
for (int32_t i = NUM_LEDS - 1; i >= NUM_LEDS / 2; i--) {
strip.setPixelColor(i, strip.getPixelColor(NUM_LEDS - 1 - i));
}
if (++start >= NUM_LEDS / 2) start = 0;
strip.show();
delay(wait);
}