#include <Adafruit_NeoPixel.h>
const int pin = 2;
const int ledsCount = 300;
Adafruit_NeoPixel strip(ledsCount, pin, NEO_GRB + NEO_KHZ800);
unsigned long timestamp;
const int time = 100; // time in ms
const int ledOn = 2;
const int ledOff = 2;
void setup() {
strip.begin();
strip.setBrightness(100);
strip.show();
strip.setPixelColor(0, strip.Color(255,0,0));
for(int i = 0; i < strip.numPixels(); i++){
}
}
void loop() {
if(millis() - timestamp > time){
timestamp = millis();
moveOneLed();
}
}
void moveOneLed(){
uint32_t lastColor = strip.getPixelColor(strip.numPixels() - 1);
for(int i = strip.numPixels() - 1; i > 0; i--){
strip.setPixelColor(i, strip.getPixelColor(i-1));
}
strip.setPixelColor(0, lastColor);
strip.show();
}