Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_NeoPixel.h>
- #ifdef __AVR__
- #include <avr/power.h>
- #endif
- #define PIN 0
- #define NUMPIXELS 21
- Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
- int delayval = 100;
- void setup() {
- pixels.begin();
- }
- void loop() {
- // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
- for(int i=-1;i<NUMPIXELS;){
- if (i < NUMPIXELS-1){
- i++;
- pixels.setPixelColor(i, pixels.Color(0,255,0));
- pixels.show();
- delay(delayval);
- }
- else{
- for(i>=-1;i+1;){
- pixels.setPixelColor(i, pixels.Color(0,0,255));
- i--;
- pixels.show();
- delay(delayval);
- }
- }
- }
- }
RAW Paste Data