Class SolidColor

java.lang.Object
com.ctre.phoenix6.controls.SolidColor
All Implemented Interfaces:
ControlRequest, Cloneable

public final class SolidColor extends Object implements ControlRequest, Cloneable
Sets LEDs to a solid color.

  • Field Details

    • LEDStartIndex

      public int LEDStartIndex
      The index of the first LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip.
    • LEDEndIndex

      public int LEDEndIndex
      The index of the last LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip.
    • Color

      public RGBWColor Color
      The color to apply to the LEDs.
  • Constructor Details

    • SolidColor

      public SolidColor(int LEDStartIndex, int LEDEndIndex)
      Sets LEDs to a solid color.

      Parameters:
      LEDStartIndex - The index of the first LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip.
      LEDEndIndex - The index of the last LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip.
  • Method Details

    • getName

      public String getName()
      Description copied from interface: ControlRequest
      Gets the name of this control request.
      Specified by:
      getName in interface ControlRequest
      Returns:
      Name of the control request
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • sendRequest

      public StatusCode sendRequest(CANBus network, int deviceHash)
      Specified by:
      sendRequest in interface ControlRequest
    • getControlInfo

      Gets information about this control request.
      Specified by:
      getControlInfo in interface ControlRequest
      Returns:
      Map of control parameter names and corresponding applied values
    • withLEDStartIndex

      public SolidColor withLEDStartIndex(int newLEDStartIndex)
      Modifies this Control Request's LEDStartIndex parameter and returns itself for method-chaining and easier to use request API.

      The index of the first LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip.

      Parameters:
      newLEDStartIndex - Parameter to modify
      Returns:
      Itself
    • withLEDEndIndex

      public SolidColor withLEDEndIndex(int newLEDEndIndex)
      Modifies this Control Request's LEDEndIndex parameter and returns itself for method-chaining and easier to use request API.

      The index of the last LED this animation controls (inclusive). Indices 0-7 control the onboard LEDs, and 8-399 control an attached LED strip.

      Parameters:
      newLEDEndIndex - Parameter to modify
      Returns:
      Itself
    • withColor

      public SolidColor withColor(RGBWColor newColor)
      Modifies this Control Request's Color parameter and returns itself for method-chaining and easier to use request API.

      The color to apply to the LEDs.

      Parameters:
      newColor - Parameter to modify
      Returns:
      Itself
    • withUpdateFreqHz

      public SolidColor withUpdateFreqHz(double newUpdateFreqHz)
      Sets the frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.

      If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.

      Specified by:
      withUpdateFreqHz in interface ControlRequest
      Parameters:
      newUpdateFreqHz - Parameter to modify
      Returns:
      Itself
    • withUpdateFreqHz

      public SolidColor withUpdateFreqHz(Frequency newUpdateFreqHz)
      Sets the frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.

      If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.

      Specified by:
      withUpdateFreqHz in interface ControlRequest
      Parameters:
      newUpdateFreqHz - Parameter to modify
      Returns:
      Itself
    • clone

      public SolidColor clone()
      Overrides:
      clone in class Object