Add anim command to run FastLED animation from loop()
This commit is contained in:
@@ -124,6 +124,21 @@ void handle_serial_command(const String& cmd) {
|
|||||||
Serial.println(" pixel0/pixel1 - single pixel test");
|
Serial.println(" pixel0/pixel1 - single pixel test");
|
||||||
Serial.println(" gpiotest - raw GPIO pin diagnostic");
|
Serial.println(" gpiotest - raw GPIO pin diagnostic");
|
||||||
Serial.println(" rawled - bit-bang WS2812 (no library)");
|
Serial.println(" rawled - bit-bang WS2812 (no library)");
|
||||||
|
Serial.println(" anim - re-run startup animation from loop");
|
||||||
|
} else if (cmd == "anim") {
|
||||||
|
Serial.println("[CMD] Running animation...");
|
||||||
|
uint32_t colors[] = {0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF, 0xFFFFFF};
|
||||||
|
for (int c = 0; c < 7; c++) {
|
||||||
|
uint8_t r = (colors[c] >> 16) & 0xFF;
|
||||||
|
uint8_t g = (colors[c] >> 8) & 0xFF;
|
||||||
|
uint8_t b = colors[c] & 0xFF;
|
||||||
|
Serial.printf(" Colour %d: #%06X\n", c, colors[c]);
|
||||||
|
for (int i = 0; i < 8; i++) mux.set_led_color(i, r, g, b);
|
||||||
|
mux.show();
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
mux.clear_all();
|
||||||
|
Serial.println("[CMD] Animation done");
|
||||||
} else if (cmd == "rawled") {
|
} else if (cmd == "rawled") {
|
||||||
uint8_t pin = 9;
|
uint8_t pin = 9;
|
||||||
Serial.println("[CMD] Bit-bang WS2812: pixel 0 = RED on GPIO 9");
|
Serial.println("[CMD] Bit-bang WS2812: pixel 0 = RED on GPIO 9");
|
||||||
|
|||||||
Reference in New Issue
Block a user