Last active
August 29, 2015 14:06
-
-
Save sulram/d106fb554bd3801d9e4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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