11eb2584ef
Arduino Uno + WS2812B LED strip controller with a text-based lightshow system. Shows are defined as .txt files (hex color + fade duration per step), converted to PROGMEM headers by convert_all.py, and navigated at runtime via a debounced button (tap/double-tap/hold). BSD 2-Clause license. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
761 B
C++
26 lines
761 B
C++
// SPDX-License-Identifier: BSD-2-Clause
|
|
#include "led_controller.h"
|
|
|
|
// Internal LED buffer — FastLED writes to this array, then pushes it to the strip.
|
|
static CRGB leds[NUM_LEDS];
|
|
|
|
void leds_begin() {
|
|
FastLED.addLeds<LED_TYPE, LED_DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
|
|
FastLED.setBrightness(MAX_BRIGHTNESS);
|
|
FastLED.clear(true); // clear + show: strip starts fully off
|
|
}
|
|
|
|
void leds_apply_color(CRGB color) {
|
|
#if ACTIVE_PATTERN == PATTERN_SOLID
|
|
// All LEDs show the same color.
|
|
fill_solid(leds, NUM_LEDS, color);
|
|
|
|
// To add a new pattern, add a new #define in config.h and a new branch here.
|
|
// The pattern receives 'leds', 'NUM_LEDS', and the blended 'color' for this frame.
|
|
#endif
|
|
}
|
|
|
|
void leds_show() {
|
|
FastLED.show();
|
|
}
|