void ledsOn(uint8_t hue, uint8_t saturation, uint8_t brightness) { const uint8_t duration = 255; static uint32_t lastMillis; if (millis() - lastMillis >= 10) { lastMillis = millis(); for (uint16_t led = 0; led < NUM_LEDS; led++) { leds[led] = CHSV(hue, saturation, brightness); } FastLED.show(); } } void ledsRainbowLeft(uint8_t saturation, uint8_t brightness, uint32_t duration, uint8_t width) { uint8_t shift = (255 * millis() / duration) % 255; uint8_t hue; for (int16_t led = 0; led < NUM_LEDS; led++) { hue = (led * 255 / width + shift) % 255; leds[led] = CHSV(hue, saturation, brightness); } FastLED.show(); } void ledsLarsonScanner(uint8_t hue, uint8_t saturation, uint8_t brightness, uint32_t duration, uint8_t width) { static uint32_t lastMillis; static int16_t led; static bool reverse; if (millis() - lastMillis >= duration) { lastMillis = millis(); if (led <= 0) reverse = false; else if (led >= NUM_LEDS - 1) reverse = true; if (reverse) led--; else led++; for (int rwLed = 1; rwLed <= width && led + rwLed < NUM_LEDS; rwLed++) { leds[led + rwLed] = CHSV(hue, saturation, brightness *(width - rwLed) / width); } leds[led] = CHSV(hue, saturation, brightness); for (int fwLed = 1; fwLed <= width && (led - fwLed) >= 0; fwLed++) { leds[(led - fwLed)] = CHSV(hue, saturation, brightness *(width - fwLed) / width); } FastLED.show(); } } void ledsLarsonScannerShiftColor(uint8_t saturation, uint8_t brightness, uint32_t duration, uint8_t width) { static uint32_t lastMillis; static int16_t led; static bool reverse; static uint8_t hue; if (millis() - lastMillis >= duration) { lastMillis = millis(); if (hue < 255) hue++; else hue = 0; if (led <= 0) reverse = false; else if (led >= NUM_LEDS - 1) reverse = true; if (reverse)led--; else led++; for (int rwLed = 1; rwLed <= width && led + rwLed < NUM_LEDS; rwLed++) { leds[led + rwLed] = CHSV(hue, saturation, brightness * (width - rwLed) / width); } leds[led] = CHSV(hue, saturation, brightness); for (int fwLed = 1; fwLed <= width && (led - fwLed) >= 0; fwLed++) { leds[(led - fwLed)] = CHSV(hue, saturation, brightness * (width - fwLed) / width); } FastLED.show(); } }