#include <Adafruit_NeoPixel.h>
#define NEO_PIN1 16 // top row
#define NEO_PIN2 17 // bottom row
#define LED_COUNT 10 // per row
#define WAIT_TIME 150
Adafruit_NeoPixel strip_top(LED_COUNT, NEO_PIN1, NEO_GRB + NEO_KHZ800); // top row
Adafruit_NeoPixel strip_bot(LED_COUNT, NEO_PIN2, NEO_GRB + NEO_KHZ800); // bottom row
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
#define yel 0xffff00
#define red 0xff0000
#define grn 0x00ff00
#define blu 0x0000ff
#define off 0x000000
static uint32_t aPatternsL[][10] = {
{ blu, off, yel, off, off, off, off, off, red, off },
{ off, blu, yel, yel, off, off, off, off, off, red },
{ blu, off, yel, yel, yel, off, off, off, red, off },
{ off, blu, yel, yel, yel, yel, off, off, off, red },
{ blu, off, yel, yel, yel, yel, yel, off, red, off },
{ off, blu, yel, yel, yel, yel, yel, yel, off, red },
{ blu, blu, blu, blu, blu, red, red, red, red, red }, // just reds and blues from here
{ off, off, blu, blu, blu, off, off, red, red, red },
{ blu, blu, off, off, blu, red, red, off, off, red },
{ off, blu, off, blu, off, red, off, red, off, red },
{ grn, off, off, off, off, off, off, off, off, off } // keep this last
};
static uint32_t aPatternsR[][10] = {
{ blu, blu, off, off, off, off, off, yel, red, red },
{ off, off, off, off, off, off, yel, yel, off, off },
{ blu, blu, off, off, off, yel, yel, yel, red, red },
{ off, off, off, off, yel, yel, yel, yel, off, off },
{ blu, blu, off, yel, yel, yel, yel, yel, red, red },
{ off, off, yel, yel, yel, yel, yel, yel, off, off },
{ blu, blu, blu, blu, blu, red, red, red, red, red }, // just reds and blues from here
{ off, off, blu, blu, blu, off, off, red, red, red },
{ blu, blu, off, off, blu, red, red, off, off, red },
{ off, blu, off, blu, off, red, off, red, off, red },
{ grn, off, off, off, off, off, off, off, off, off } // keep this last
};
void display_pattern_L(unsigned long wait) {
int row, col;
for(row = 0; row < 100; row++) {
for(col = 0; col < strip_bot.numPixels(); col++) {
strip_bot.setPixelColor(col, aPatternsL[row][col]);
}
if (aPatternsL[row][0] == grn)
break;
strip_bot.show();
delay(wait);
}
}
void display_pattern_R(unsigned long wait) {
int row, col;
for(row = 0; row < 100; row++) {
for(col = 0; col < strip_bot.numPixels(); col++) {
strip_bot.setPixelColor(col, aPatternsR[row][col]);
}
if (aPatternsR[row][0] == grn)
break;
strip_bot.show();
delay(wait);
}
}
/*
/////////////////////////////////////////////////////////////////////////////
void colorWipe1(uint32_t color, int wait) {
for(int i = 0;i < strip1.numPixels();i++) { // For each pixel in strip...
strip1.setPixelColor(i, color); // Set pixel's color (in RAM)
strip1.show(); // Update strip to match
delay(wait); // Pause for a moment
}
}
*/
/////////////////////////////////////////////////////////////////////////////
void setup() {
Serial.begin(115200);
strip_top.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip_top.show(); // Turn OFF all pixels ASAP
strip_top.setBrightness(100); // Set BRIGHTNESS to about 1/5 (max = 255)
strip_bot.begin();
strip_bot.show();
strip_bot.setBrightness(100);
}
/////////////////////////////////////////////////////////////////////////////
void loop() {
int i;
for(i = 0; i < 5; i++)
display_pattern_L(WAIT_TIME);
for(i = 0; i < 5; i++)
display_pattern_R(WAIT_TIME);
// Fill along the length of the strip in various colors...
// colorWipe1(strip1.Color(255, 0, 0), 50); // Red
// colorWipe1(strip1.Color( 0, 255, 0), 50); // Green
// colorWipe1(strip1.Color( 0, 0, 255), 50); // Blue
delay(10); // this speeds up the simulation
}