#include <Adafruit_NeoPixel.h>
#define NEOPIXEL_PIN 10
#define NEOPIXEL_NUM 3
Adafruit_NeoPixel pixels(NEOPIXEL_NUM, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin(); // Initialize NeoPixel strip
}
void loop() {
// Step 1: Red on the first pixel, others off
pixels.clear(); // Clear all pixels
pixels.setPixelColor(0, pixels.Color(255, 0, 0)); // Red on pixel 0
pixels.show(); // Update all pixels
delay(1000); // Wait for 1 second
// Step 2: Green on the second pixel, others off
pixels.clear(); // Clear all pixels
pixels.setPixelColor(1, pixels.Color(0, 255, 0)); // Green on pixel 1
pixels.show(); // Update all pixels
delay(1000); // Wait for 1 second
// Step 3: Blue on the third pixel, others off
pixels.clear(); // Clear all pixels
pixels.setPixelColor(2, pixels.Color(0, 0, 255)); // Blue on pixel 2
pixels.show(); // Update all pixels
delay(1000); // Wait for 1 second
}