#include <Adafruit_NeoPixel.h>
#define PIN 7
#define NUM_LEDS 16
Adafruit_NeoPixel strip(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
int potPin = A0;
int potValue = 0;
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
potValue = analogRead(potPin);
int ledOffset = map(potValue, 0, 1023, 0, NUM_LEDS);
for (int i = 0; i < NUM_LEDS; i++) {
int pixelIndex = (i + ledOffset) % NUM_LEDS;
strip.setPixelColor(i, 0, 0, 0);
strip.setPixelColor(pixelIndex, 255, 255, 255);
}
strip.show();
delay(10);
}