Class AddressableLEDSim

java.lang.Object
edu.wpi.first.wpilibj.simulation.AddressableLEDSim

public class AddressableLEDSim extends Object
Class to control a simulated addressable LED.
  • Constructor Details

    • AddressableLEDSim

      public AddressableLEDSim(int channel)
      Constructs an addressable LED for a specific channel.
      Parameters:
      channel - output channel
    • AddressableLEDSim

      public AddressableLEDSim(AddressableLED addressableLED)
      Constructs from an AddressableLED object.
      Parameters:
      addressableLED - AddressableLED to simulate
  • Method Details

    • registerInitializedCallback

      public CallbackStore registerInitializedCallback(NotifyCallback callback, boolean initialNotify)
      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 associated with this callback.
    • getInitialized

      public boolean getInitialized()
      Check if initialized.
      Returns:
      true if initialized
    • setInitialized

      public void setInitialized(boolean initialized)
      Change the Initialized value of the LED strip.
      Parameters:
      initialized - the new value
    • registerStartCallback

      public CallbackStore registerStartCallback(NotifyCallback callback, boolean initialNotify)
      Register a callback on the start.
      Parameters:
      callback - the callback that will be called whenever the start is changed
      initialNotify - if true, the callback will be run on the initial value
      Returns:
      the CallbackStore object associated with this callback.
    • getStart

      public int getStart()
      Get the start.
      Returns:
      the start
    • setStart

      public void setStart(int start)
      Change the start.
      Parameters:
      start - the new start
    • registerLengthCallback

      public CallbackStore registerLengthCallback(NotifyCallback callback, boolean initialNotify)
      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.
    • getLength

      public int getLength()
      Get the length of the LED strip.
      Returns:
      the length
    • setLength

      public void setLength(int length)
      Change the length of the LED strip.
      Parameters:
      length - the new value
    • registerDataCallback

      Register a callback on the LED data.
      Parameters:
      callback - the callback that will be called whenever the LED data is changed
      Returns:
      the CallbackStore object associated with this callback.
    • getData

      public byte[] getData()
      Get the LED data.
      Returns:
      the LED data
    • setData

      public void setData(byte[] data)
      Change the LED data.
      Parameters:
      data - the new data
    • getGlobalData

      public static byte[] getGlobalData(int start, int length)
      Get the global LED data.
      Parameters:
      start - start, in LEDs
      length - length, in LEDs
      Returns:
      the LED data
    • setGlobalData

      public static void setGlobalData(int start, byte[] data)
      Change the global LED data.
      Parameters:
      start - start, in LEDs
      data - the new data
    • resetData

      public void resetData()
      Reset all simulation data for this LED object.