Skip to content

Instantly share code, notes, and snippets.

@adlerweb
Created March 22, 2026 00:23
Show Gist options
  • Select an option

  • Save adlerweb/0726598a6b5d999937432e4b1774ec33 to your computer and use it in GitHub Desktop.

Select an option

Save adlerweb/0726598a6b5d999937432e4b1774ec33 to your computer and use it in GitHub Desktop.
esphome:
name: rgbtube
friendly_name: rgbtube
esp32:
board: esp32-c3-devkitm-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: […]
ota:
- platform: esphome
password: […]
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
network:
enable_ipv6: true
min_ipv6_addr_count: 2
web_server:
version: 3
number:
- platform: template
name: "Effect Speed"
id: effect_speed
min_value: 20
max_value: 1000
step: 10
initial_value: 100
unit_of_measurement: "ms"
optimistic: true
light:
- platform: fastled_clockless
chipset: UCS1903
pin: GPIO4
num_leds: 11
rgb_order: BRG
name: "UCS1903"
effects:
- addressable_rainbow:
# 1. CUSTOM STROBE (Uses current color + slider speed)
- addressable_lambda:
name: "Dynamic Strobe"
update_interval: 10ms
lambda: |-
static uint32_t last_run = 0;
static bool state = false;
uint32_t now = millis();
if (now - last_run > id(effect_speed).state) {
state = !state;
if (state) {
it.all() = current_color;
} else {
it.all() = Color::BLACK;
}
last_run = now;
}
# 2. SCAN D1 (Forward)
- addressable_lambda:
name: "Scan Forward"
update_interval: 10ms
lambda: |-
static uint32_t last_run = 0;
static int pos = 0;
if (initial_run) pos = 0;
if (millis() - last_run > id(effect_speed).state) {
it.all() = Color::BLACK;
if (pos < it.size()) {
it[pos] = current_color;
}
pos++;
if (pos >= it.size()) pos = 0;
last_run = millis();
}
# 3. SCAN D2 (Backward)
- addressable_lambda:
name: "Scan Backward"
update_interval: 10ms
lambda: |-
static uint32_t last_run = 0;
static int pos = 0;
if (initial_run) pos = it.size() - 1;
if (millis() - last_run > id(effect_speed).state) {
it.all() = Color::BLACK;
if (pos >= 0) {
it[pos] = current_color;
}
pos--;
if (pos < 0) pos = it.size() - 1;
last_run = millis();
}
# 4. CUSTOM ADDRESSABLE SCAN (Bounce effect)
- addressable_lambda:
name: "Dynamic Bounce"
update_interval: 10ms
lambda: |-
static uint32_t last_run = 0;
static int pos = 0;
static int direction = 1;
if (millis() - last_run > id(effect_speed).state) {
it.all() = Color::BLACK;
it[pos] = current_color;
pos += direction;
if (pos >= it.size() - 1 || pos <= 0) {
direction *= -1;
}
last_run = millis();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment