#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 200 // millis
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 wi_red for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wi_red for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wi_red for RGBW bitstream (NeoPixel RGBW products)
#define _yel 0xffff00
#define _red 0xff0000
#define _grn 0x00ff00
#define _blu 0x0000ff
#define _off 0x000000
#define _stp 0xffffff // stop
static uint32_t patternsL[][LED_COUNT] = {
{ _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,_off,_off,_off,_off,_off,_off,_off,_red,_off },
{ _off,_blu,_yel,_yel,_yel,_yel,_yel,_yel,_off,_red },
{ _stp,_off,_off,_off,_off,_off,_off,_off,_off,_off } // keep this last
};
static uint32_t patternsR[][LED_COUNT] = {
{ _blu,_off,_off,_off,_off,_off,_off,_yel,_red,_off },
{ _off,_blu,_off,_off,_off,_off,_yel,_yel,_off,_red },
{ _blu,_off,_off,_off,_off,_yel,_yel,_yel,_red,_off },
{ _off,_blu,_off,_off,_yel,_yel,_yel,_yel,_off,_red },
{ _blu,_off,_off,_yel,_yel,_yel,_yel,_yel,_red,_off },
{ _off,_blu,_yel,_yel,_yel,_yel,_yel,_yel,_off,_red },
{ _blu,_off,_off,_off,_off,_off,_off,_off,_red,_off },
{ _off,_blu,_yel,_yel,_yel,_yel,_yel,_yel,_off,_red },
{ _stp,_off,_off,_off,_off,_off,_off,_off,_off,_off } // keep this last
};
static uint32_t rollL[][LED_COUNT] = {
{ _yel,_yel,_yel,_off,_off,_off,_off,_off,_off,_off },
{ _off,_yel,_yel,_yel,_off,_off,_off,_off,_off,_off },
{ _off,_off,_yel,_yel,_yel,_off,_off,_off,_off,_off },
{ _off,_off,_off,_yel,_yel,_yel,_off,_off,_off,_off },
{ _off,_off,_off,_off,_yel,_yel,_yel,_off,_off,_off },
{ _off,_off,_off,_off,_off,_yel,_yel,_yel,_off,_off },
{ _off,_off,_off,_off,_off,_off,_yel,_yel,_yel,_off },
{ _off,_off,_off,_off,_off,_off,_off,_yel,_yel,_yel },
{ _stp,_off,_off,_off,_off,_off,_off,_off,_off,_off } // keep this last
};
static uint32_t rollR[][LED_COUNT] = {
{ _off,_off,_off,_off,_off,_off,_off,_yel,_yel,_yel },
{ _off,_off,_off,_off,_off,_off,_yel,_yel,_yel,_off },
{ _off,_off,_off,_off,_off,_yel,_yel,_yel,_off,_off },
{ _off,_off,_off,_off,_yel,_yel,_yel,_off,_off,_off },
{ _off,_off,_off,_yel,_yel,_yel,_off,_off,_off,_off },
{ _off,_off,_yel,_yel,_yel,_off,_off,_off,_off,_off },
{ _off,_yel,_yel,_yel,_off,_off,_off,_off,_off,_off },
{ _yel,_yel,_yel,_off,_off,_off,_off,_off,_off,_off },
{ _stp,_off,_off,_off,_off,_off,_off,_off,_off,_off } // keep this last
};
/////////////////////////////////////////////////////////////////////////////
void display_patterns(uint32_t top[][LED_COUNT], uint32_t bot[][LED_COUNT], unsigned long wait) {
int row, col;
for(row = 0; row < 100; row++) {
if (top[row][0] == _stp || bot[row][0] == _stp)
break;
for(col = 0; col < LED_COUNT; col++) {
strip_top.setPixelColor(col, top[row][col]);
strip_bot.setPixelColor(col, bot[row][col]);
}
strip_top.show();
strip_bot.show();
delay(wait);
}
}
/*
void display_patterns_top(uint32_t patterns[][LED_COUNT], unsigned long wait) {
int row, col;
for(row = 0; row < 100; row++) {
if (patterns[row][0] == _stp)
break;
for(col = 0; col < strip_top.numPixels(); col++) {
strip_top.setPixelColor(col, patterns[row][col]);
}
strip_top.show();
delay(wait);
}
}
void display_patterns_bot(uint32_t patterns[][LED_COUNT], unsigned long wait) {
int row, col;
for(row = 0; row < 100; row++) {
if (patterns[row][0] == _stp)
break;
for(col = 0; col < strip_bot.numPixels(); col++) {
strip_bot.setPixelColor(col, patterns[row][col]);
}
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 (REQUI_red)
strip_top.show(); // Turn _off all pixels ASAP
strip_top.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
strip_bot.begin();
strip_bot.show();
strip_bot.setBrightness(50);
}
/////////////////////////////////////////////////////////////////////////////
void loop() {
int i;
for(i = 0; i < 5; i++)
display_patterns(rollL, patternsL, WAIT_TIME);
for(i = 0; i < 5; i++)
display_patterns(rollR, patternsR, WAIT_TIME);
// for(i = 0; i < 5; i++)
// display_patterns_bot(patternsL, WAIT_TIME);
// for(i = 0; i < 5; i++)
// display_patterns_bot(patternsR, 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 (???)
}