#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
// Built-in RGB LED pin (usually GPIO8 on ESP32-C3 Mini)
#define RGB_PIN 8
#define NUMPIXELS 5 // only one built-in LED
Adafruit_NeoPixel pixels(NUMPIXELS, RGB_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin(); // initialize NeoPixel
pixels.setBrightness(50); // adjust brightness (0–255)
}
void loop() {
// Rainbow animation
for (int i = 0; i < 256; i++) {
uint32_t color = pixels.Color(
(sin((i + 0) * 0.024) * 127) + 128, // Red
(sin((i + 85) * 0.024) * 127) + 128, // Green
(sin((i + 170) * 0.024) * 127) + 128 // Blue
);
pixels.setPixelColor(0, color);
pixels.show();
delay(20); // adjust speed
}
}