#include <Adafruit_NeoPixel.h>
#define PIX_PIN 5
#define PIX_NUM 300
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIX_NUM, PIX_PIN, NEO_GRB + NEO_KHZ800);
uint8_t delayTime = 100; // 100 for hardware 20 for Wokwi
void setup() {
// Serial.begin(9600);
strip.begin(); // initialize the strip
}
void loop() {
// red_wht_blu();
// red_pnk_gry();
cyn_org();
}
void red_wht_blu() {
theaterChase(strip.Color(255, 255, 255), delayTime); // WHT
theaterChase(strip.Color(000, 000, 255), delayTime); // BLU
theaterChase(strip.Color(255, 000, 000), delayTime); // RED
}
void red_pnk_gry() {
theaterChase(strip.Color(127, 127, 127), delayTime); // GRY (dim WHT)
theaterChase(strip.Color(255, 031, 127), delayTime); // PNK
theaterChase(strip.Color(255, 000, 000), delayTime); // RED
}
void cyn_org() {
theaterChase(strip.Color(0, 127, 127), delayTime); // CYN
theaterChase(strip.Color(255, 0, 63), delayTime); // ORG
}
void theaterChase(uint32_t color, uint8_t wait) { // crawling lights with spacing
for (int q = 0; q < 10; q++) { // first pixel to first pixel
for (int i = 0; i < strip.numPixels(); i = i + 10) {
for (int j = 0; j < 6; j++) { // number or lit pixels
strip.setPixelColor(q + i + j, color);
if (q > 5)
strip.setPixelColor(q - 6, color); // fill in first pixels
}
}
strip.show();
delay(delayTime);
// set all leds off to clear the strip, do not show() or delay()
for (int i = 0; i < strip.numPixels(); i = i + 1) {
strip.setPixelColor(q + i, 0);
}
}
}