Skip to main content
LEDSubsystem drives a CTRE CANdle (CAN ID CANDLE_ID = 40) to communicate robot state to drivers and human players via color and animation. All LED output runs through three internal patterns: SOLID, ALTERNATE, and RAINBOW.

LED modes

The CANdle controls a strip of 200 LEDs (END_INDEX = 200). The SolidColor controller and RainbowAnimation both address the full range from index 0 to 199.

Pattern types

LEDPattern is an internal enum with three variants:

SOLID

Applies a single RGBWColor to all LEDs via a SolidColor control request. Used for DEFAULT, INTAKE, LAUNCH, CLIMB, and DISABLED.

ALTERNATE

Toggles between two colors (primaryColor and secondaryColor) on a configurable interval. Currently used by LAUNCHING (yellow ↔ red, 0.25 s). The toggle runs in periodic().

RAINBOW

Issues a RainbowAnimation request to the CANdle at 100 Hz frame rate, full brightness (1.0), forward direction. Used during autonomous.

Rainbow animation configuration

The animation object is created once at construction and applied via candle.setControl(rainbowAnimation).

setMode

setMode(LEDMode mode) is idempotent — it exits early if the requested mode matches the current mode:

flashCommand

flashCommand(RGBWColor color, int times, double interval) returns a Command that blinks the LEDs times times at the given interval (seconds per half-cycle), then restores the previous mode:
Controls.java uses this to flash orange 30 times at 0.1 s on a readyToShoot falling edge, and green 3 times at 0.2 s on the zero-subsystems start button.

Disabled behavior

periodic() checks RobotState.isDisabled() each cycle. When disabled, it forces setMode(LEDMode.DISABLED) — turning all LEDs off — regardless of the last teleop mode. When the robot re-enables, the ledsMode field in Controls.java restores the appropriate mode on the next periodic cycle.

NetworkTables topics

Trigger conditions from Controls.java