#include <Adafruit_NeoPixel.h> // the name of the library
#define PIN 6 // pin for neopixel
#define NUMPIXELS 16 // number of neopixels
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // "NUMPIXELS" and "PIN" are used here
int value = 100; // arbitrary delay value
bool j; // generic counter
void setup() {
pixels.begin(); // INITIALIZE neopixel
}
void loop() {
pixels.clear(); // Set all pixel colors to 'off'
j = !j; // two cycles - j = 0 and j = 1
for (byte i = 0; i < NUMPIXELS; i++) { // For each pixel...
if (j) // if j == 1... do this...
pixels.setPixelColor(i, pixels.Color(0, 150, 0)); // pick a pixel {i} and a color (red, grn, blu)
else // if j == 0... do this...
pixels.setPixelColor((NUMPIXELS) - i, pixels.Color(0, 150, 0)); // make it brighter
if ((i == 0) || (i == NUMPIXELS))
pixels.setPixelColor(i, pixels.Color(191, 255, 0));
pixels.show(); // show the update
delay(value); // keep pixel on briefly
pixels.clear();
pixels.show(); // show the update
}
}