#include <Adafruit_NeoPixel.h>
#define PIN 21 // Define the pin where the data line is connected to
#define NUMPIXELS 10 // Define the number of pixels in the strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin(); // Initialize the strip
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
colorWipe(strip.Color(255, 0, 0), 50); // Red
delay(500);
colorWipe(strip.Color(0, 255, 0), 50); // Green
delay(500);
colorWipe(strip.Color(0, 0, 255), 50); // Blue
delay(500);
}
// Fill the dots one after the other with a color
void colorWipe(uint32_t color, int wait) {
for(int i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, color);
strip.show();
delay(wait);
}
}