AddressableLED
- class wpilib.AddressableLED(channel: SupportsInt | SupportsIndex)
Bases:
pybind11_objectA class for driving addressable LEDs, such as WS2812B, WS2815, and NeoPixels.
Some LEDs use a different color order than the default GRB. The color order is configurable using SetColorOrder().
Up to 1024 LEDs may be controlled in total across all AddressableLED instances. A single global buffer is used for all instances. The start position used for LED data for the output is set via SetStart() and the length of the strip is set via SetLength(). Both of these default to zero, so multiple instances will access the same pixel data unless SetStart() is called to adjust the starting point.
Constructs a new driver for a specific channel.
- Parameters:
channel – the output channel to use
- class ColorOrder(value: SupportsInt | SupportsIndex)
Bases:
pybind11_objectOrder that color data is sent over the wire.
Members:
RGB : ///< RGB order
RBG : ///< RBG order
BGR : ///< BGR order
BRG : ///< BRG order
GBR : ///< GBR order
GRB : ///< GRB order. This is the default order.
- BGR = <ColorOrder.BGR: 2>
- BRG = <ColorOrder.BRG: 3>
- GBR = <ColorOrder.GBR: 4>
- GRB = <ColorOrder.GRB: 5>
- RBG = <ColorOrder.RBG: 1>
- RGB = <ColorOrder.RGB: 0>
- AddressableLED.ColorOrder.name -> str
- property value
- class LEDData(*args, **kwargs)
Bases:
pybind11_objectOverloaded function.
__init__(self: wpilib._wpilib.AddressableLED.LEDData) -> None
__init__(self: wpilib._wpilib.AddressableLED.LEDData, r: typing.SupportsInt | typing.SupportsIndex, g: typing.SupportsInt | typing.SupportsIndex, b: typing.SupportsInt | typing.SupportsIndex) -> None
- setHSV(h: SupportsInt | SupportsIndex, s: SupportsInt | SupportsIndex, v: SupportsInt | SupportsIndex) None
A helper method to set all values of the LED.
- Parameters:
h – the h value [0-180]
s – the s value [0-255]
v – the v value [0-255]
- setLED(*args, **kwargs)
Overloaded function.
setLED(self: wpilib._wpilib.AddressableLED.LEDData, color: wpiutil._wpiutil.Color) -> None
setLED(self: wpilib._wpilib.AddressableLED.LEDData, color: wpiutil._wpiutil.Color8Bit) -> None
- setRGB(r: SupportsInt | SupportsIndex, g: SupportsInt | SupportsIndex, b: SupportsInt | SupportsIndex) None
A helper method to set all values of the LED.
- Parameters:
r – the r value [0-255]
g – the g value [0-255]
b – the b value [0-255]
- getChannel() int
Gets the channel for this addressable LED.
- Returns:
channel
- getStart() int
Gets the display start of the LED strip in the global buffer.
- Returns:
the strip start, in LEDs
- setColorOrder(order: wpilib._wpilib.AddressableLED.ColorOrder) None
Sets the color order for this AddressableLED. The default order is GRB.
This will take effect on the next call to SetData().
- Parameters:
order – the color order
- setData(ledData: List[wpilib._wpilib.AddressableLED.LEDData]) None
Sets the LED output data. This will write to the global buffer starting at the location set by SetStart() and up to the length set by SetLength().
- Parameters:
ledData – the buffer to write
- static setGlobalData(start: SupportsInt | SupportsIndex, colorOrder: wpilib._wpilib.AddressableLED.ColorOrder, ledData: List[wpilib._wpilib.AddressableLED.LEDData]) None
Sets the LED output data at an arbitrary location in the global buffer.
- Parameters:
start – the start location, in LEDs
colorOrder – the color order
ledData – the buffer to write
- setLength(length: SupportsInt | SupportsIndex) None
Sets the length of the LED strip.
- Parameters:
length – the strip length, in LEDs
- setStart(start: SupportsInt | SupportsIndex) None
Sets the display start of the LED strip in the global buffer.
- Parameters:
start – the strip start, in LEDs