AddressableLEDSim

class wpilib.simulation.AddressableLEDSim(*args, **kwargs)

Bases: pybind11_object

Class to control a simulated addressable LED.

Overloaded function.

  1. __init__(self: wpilib.simulation._simulation.AddressableLEDSim) -> None

Constructs for the first addressable LED.

  1. __init__(self: wpilib.simulation._simulation.AddressableLEDSim, addressableLED: wpilib._wpilib.AddressableLED) -> None

Constructs from an AddressableLED object.

Parameters:

addressableLED – AddressableLED to simulate

static createForChannel(pwmChannel: int) wpilib.simulation._simulation.AddressableLEDSim

Creates an AddressableLEDSim for a PWM channel.

Parameters:

pwmChannel – PWM channel

Returns:

Simulated object @throws std::out_of_range if no AddressableLED is configured for that channel

static createForIndex(index: int) wpilib.simulation._simulation.AddressableLEDSim

Creates an AddressableLEDSim for a simulated index. The index is incremented for each simulated AddressableLED.

Parameters:

index – simulator index

Returns:

Simulated object

getData(data: hal._wpiHal.AddressableLEDData) int

Get the LED data.

Parameters:

data – output parameter to fill with LED data

Returns:

the length of the LED data

getInitialized() bool

Check if initialized.

Returns:

true if initialized

getLength() int

Get the length of the LED strip.

Returns:

the length

getOutputPort() int

Get the output port.

Returns:

the output port

getRunning() int

Check if the LEDs are running.

Returns:

true if they are

registerDataCallback(callback: Callable[[str, int, int], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore

Register a callback on the LED data.

Parameters:
  • callback – the callback that will be called whenever the LED data is changed

  • initialNotify – if true, the callback will be run on the initial value

Returns:

the CallbackStore object associated with this callback

registerInitializedCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore

Register a callback on the Initialized property.

Parameters:
  • callback – the callback that will be called whenever the Initialized property is changed

  • initialNotify – if true, the callback will be run on the initial value

Returns:

the CallbackStore object storing this callback

registerLengthCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore

Register a callback on the length.

Parameters:
  • callback – the callback that will be called whenever the length is changed

  • initialNotify – if true, the callback will be run on the initial value

Returns:

the CallbackStore object associated with this callback

registerOutputPortCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore

Register a callback on the output port.

Parameters:
  • callback – the callback that will be called whenever the output port is changed

  • initialNotify – if true, the callback will be run on the initial value

Returns:

the CallbackStore object associated with this callback

registerRunningCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore

Register a callback on whether the LEDs are running.

Parameters:
  • callback – the callback that will be called whenever the LED state is changed

  • initialNotify – if true, the callback will be run on the initial value

Returns:

the CallbackStore object associated with this callback

setData(data: hal._wpiHal.AddressableLEDData, length: int) None

Change the LED data.

Parameters:
  • data – the new data

  • length – the length of the LED data

setInitialized(initialized: bool) None

Change the Initialized value of the LED strip.

Parameters:

initialized – the new value

setLength(length: int) None

Change the length of the LED strip.

Parameters:

length – the new value

setOutputPort(outputPort: int) None

Change the output port.

Parameters:

outputPort – the new output port

setRunning(running: bool) None

Change whether the LEDs are active.

Parameters:

running – the new value