#include <Adafruit_NeoPixel.h>
#define STRIP_PIN 2
#define NUM_PIXELS 8
Adafruit_NeoPixel strip(NUM_PIXELS, STRIP_PIN, NEO_GRB + NEO_KHZ800);
uint8_t brightness = 0;
int8_t direction = 1;
void setup() {
strip.begin();
strip.show();
}
void loop() {
brightness += direction * 3;
if (brightness >= 255 || brightness <= 0) {
direction = -direction;
brightness = constrain(brightness, 0, 255);
}
for (int i = 0; i < NUM_PIXELS; i++) {
// Offset each pixel's brightness for a wave effect
uint8_t b = (brightness + i * 18) % 255;
strip.setPixelColor(i, strip.Color(b, 0, b / 4));
}
strip.show();
delay(30);
}