LEDs¶
raspbot.actuators.led_bar.LedBar
Controls the 14-LED WS2812 NeoPixel RGB light bar via I2C registers 0x03, 0x04, 0x08,
0x09.
Access via Robot.leds.
LedColor¶
Hardware-defined indexed colour codes (0-6):
Methods¶
Indexed-colour API¶
set_all(color, *, on=True)¶
Set all 14 LEDs to an indexed color.
| Parameter | Type | Default | Description |
|---|---|---|---|
color |
LedColor or int |
-- | One of the 7 predefined colour codes |
on |
bool |
True |
True = light up, False = turn off |
set_one(index, color, *, on=True)¶
Set a single LED at index (0-13) to an indexed color.
off_all()¶
Turn off all 14 LEDs immediately.
off_one(index)¶
Turn off a single LED at index.
Direct RGB brightness API¶
These methods bypass the indexed colour map and set raw R/G/B values (0-255 each).
set_brightness_all(r, g, b)¶
Set all LEDs to the given RGB brightness values simultaneously.
| Parameter | Description |
|---|---|
r |
Red channel 0-255 (clamped) |
g |
Green channel 0-255 (clamped) |
b |
Blue channel 0-255 (clamped) |
set_brightness_one(index, r, g, b)¶
Set a single LED at index to the given RGB brightness values.
Properties¶
count¶
Total number of LEDs on the bar (always 14).