Skip to content

Instantly share code, notes, and snippets.

@sulram
Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sulram/d106fb554bd3801d9e4a to your computer and use it in GitHub Desktop.
Save sulram/d106fb554bd3801d9e4a to your computer and use it in GitHub Desktop.
#include <Adafruit_NeoPixel.h>
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(200, PIN, NEO_GRB + NEO_KHZ800);
uint16_t pos = 0;
int tail = 20;
void setup() {
strip.begin();
strip.show();
}
void loop() {
// turn off leds
for(uint16_t i=0; i<strip.numPixels(); i++){
strip.setPixelColor(i, 0,0,0);
}
// turn on only tail
for(uint16_t i=0; i<tail; i++){
int j = (pos + i) % strip.numPixels();
strip.setPixelColor(j, 0,255,0);
}
strip.show();
delay(10);
pos = (pos + 1) % strip.numPixels();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment