class wpilib.AddressableLED(port: int)

Bases: pybind11_builtins.pybind11_object

A class for driving addressable LEDs, such as WS2812s and NeoPixels.

Only 1 LED driver is currently supported by the roboRIO.

Constructs a new driver for a specific port.


port – the output port to use (Must be a PWM header)

class LEDData(*args, **kwargs)

Bases: pybind11_builtins.pybind11_object

Overloaded function.

  1. __init__(self: wpilib._wpilib.AddressableLED.LEDData) -> None

  2. __init__(self: wpilib._wpilib.AddressableLED.LEDData, r: int, g: int, b: int) -> None

setHSV(h: int, s: int, v: int) None

A helper method to set all values of the LED.

  • h – the h value [0-180]

  • s – the s value [0-255]

  • v – the v value [0-255]

setLED(*args, **kwargs)

Overloaded function.

  1. setLED(self: wpilib._wpilib.AddressableLED.LEDData, color: wpilib._wpilib.Color) -> None

  2. setLED(self: wpilib._wpilib.AddressableLED.LEDData, color: wpilib._wpilib.Color8Bit) -> None

setRGB(r: int, g: int, b: int) None

A helper method to set all values of the LED.

  • r – the r value [0-255]

  • g – the g value [0-255]

  • b – the b value [0-255]

setBitTiming(lowTime0: nanoseconds, highTime0: nanoseconds, lowTime1: nanoseconds, highTime1: nanoseconds) None

Sets the bit timing.

By default, the driver is set up to drive WS2812s, so nothing needs to be set for those.

  • lowTime0 – low time for 0 bit

  • highTime0 – high time for 0 bit

  • lowTime1 – low time for 1 bit

  • highTime1 – high time for 1 bit

setData(ledData: List[wpilib._wpilib.AddressableLED.LEDData]) None

Sets the led output data.

If the output is enabled, this will start writing the next data cycle. It is safe to call, even while output is enabled.


ledData – the buffer to write

setLength(length: int) None

Sets the length of the LED strip.

Calling this is an expensive call, so its best to call it once, then just update data.

The max length is 5460 LEDs.


length – the strip length

setSyncTime(syncTime: microseconds) None

Sets the sync time.

The sync time is the time to hold output so LEDs enable. Default set for WS2812.


syncTime – the sync time

start() None

Starts the output.

The output writes continuously.

stop() None

Stops the output.