int stripperiod = 1000;
unsigned long time_now = 0;
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
#define PIN_NEO_PIXEL 2 // Arduino pin that connects to NeoPixel
#define NUM_PIXELS 28 // The number of LEDs pixels on NeoPixel
#define PIN_STRIP_PIXEL 4 // Arduino pin that connects to NeoPixel
#define NUM_STRIP_PIXELS 30 // The number of LEDs pixels on NeoPixel
#define DELAY_INTERVAL 250 // 250ms pause between each pixel
Adafruit_NeoPixel StripPixel(NUM_STRIP_PIXELS, PIN_STRIP_PIXEL, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel NeoPixel(NUM_PIXELS, PIN_NEO_PIXEL, NEO_GRB + NEO_KHZ800);
void setup() {
NeoPixel.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
StripPixel.begin();
StripPixel.setBrightness(75); // a value from 0 to 255
}
void loop() {
NeoPixel.clear(); // set all pixel colors to 'off'. It only takes effect if pixels.show() is called
time_now = millis();
while(millis() < time_now + period){
for (int stripPixel = 12; stripPixel < NUM_PIXELS; stripPixel--) { // for each pixel
StripPixel.setPixelColor(stripPixel, StripPixel.Color(0,148,255));
StripPixel.show();
period = 100;
}
// turn pixels to green one by one with delay between each pixel
for (int pixel = 0; pixel < NUM_PIXELS; pixel++) { // for each pixel
NeoPixel.setPixelColor(pixel, NeoPixel.Color(56, 182, 255));
NeoPixel.setPixelColor(pixel-4, NeoPixel.Color(0, 0, 0)); // it only takes effect if pixels.show() is called
NeoPixel.show();
delay(100); // send the updated pixel colors to the NeoPixel hardware.
}
// send the updated pixel colors to the NeoPixel hardware.
for (int pixel = 0; pixel < NUM_PIXELS; pixel++) { // for each pixel
NeoPixel.setPixelColor(pixel, NeoPixel.Color(56, 182, 255));
NeoPixel.setPixelColor(pixel-8, NeoPixel.Color(0, 0, 0)); // it only takes effect if pixels.show() is called
NeoPixel.show();
delay(35); // send the updated pixel colors to the NeoPixel hardware.
}
// turn off all pixels for two seconds
// send the updated pixel colors to the NeoPixel hardware.
StripPixel.clear();
StripPixel.show();
NeoPixel.clear();
NeoPixel.show();
delay(283); // off time
}
}