Class SpectrumLEDs

java.lang.Object
frc.spectrumLib.leds.SpectrumLEDs
All Implemented Interfaces:
Subsystem, SpectrumSubsystem

public class SpectrumLEDs extends Object implements SpectrumSubsystem
  • Field Details

  • Constructor Details

  • Method Details

    • periodic

      public void periodic()
      Specified by:
      periodic in interface Subsystem
    • isAttached

      public boolean isAttached()
    • checkPriority

      public Trigger checkPriority(int priority)
    • setPattern

      public Command setPattern(LEDPattern pattern, int priority)
    • setPattern

      public Command setPattern(LEDPattern pattern)
    • setupStates

      public void setupStates()
      Description copied from interface: SpectrumSubsystem
      Set up the states and triggers for this subsystem. This is typically used to bind commands to SpectrumState triggers.
      Specified by:
      setupStates in interface SpectrumSubsystem
    • setupDefaultCommand

      public void setupDefaultCommand()
      Description copied from interface: SpectrumSubsystem
      Set up the default command for this subsystem. This command will run when no other command is using this subsystem.
      Specified by:
      setupDefaultCommand in interface SpectrumSubsystem
    • stripe

      public LEDPattern stripe(double percent, Color color1, Color color2)
      LED Pattern Stripe, takes in a double percent and sets the first length number of LEDs to one color and the rest of the strip to another
    • solid

      public LEDPattern solid(Color color)
      Creates a solid LED pattern with the specified color.
      Parameters:
      color - the color to be used for the solid LED pattern
      Returns:
      an LEDPattern object representing the solid color pattern
    • blink

      public LEDPattern blink(Color c, double onTime)
      Creates an LED pattern that blinks with the specified on-time duration.
      Parameters:
      onTime - the duration (in seconds) for which the LED stays on during each blink cycle
      Returns:
      an LEDPattern that blinks with the specified on-time duration
    • breathe

      public LEDPattern breathe(Color c, double period)
      Creates a breathing LED pattern with the specified period.
      Parameters:
      period - The period of the breathing effect in seconds.
      Returns:
      An LEDPattern object representing the breathing effect.
    • rainbow

      public LEDPattern rainbow()
      Creates and returns a rainbow LED pattern with specified brightness and saturation.
      Returns:
      an LEDPattern object representing a rainbow pattern with maximum brightness (255) and medium saturation (128).
    • scrollingRainbow

      public LEDPattern scrollingRainbow()
    • rainbow

      public LEDPattern rainbow(int saturation, int value)
      Generates a rainbow LED pattern with the specified saturation and value.
      Parameters:
      saturation - the saturation level of the rainbow pattern (0-255)
      value - the brightness value of the rainbow pattern (0-255)
      Returns:
      an LEDPattern object representing the rainbow pattern
    • gradient

      public LEDPattern gradient(Color... colors)
      Creates a gradient LED pattern using the specified colors.
      Parameters:
      colors - The array of colors to be used in the gradient pattern.
      Returns:
      An LEDPattern object representing the gradient pattern.
    • scroll

      public LEDPattern scroll(LEDPattern pattern, double speedMps)
      Scrolls the given LED pattern at the specified speed.
      Parameters:
      pattern - the LEDPattern to be scrolled
      speedMps - the speed at which the pattern should scroll, in meters per second
      Returns:
      a new LEDPattern that represents the scrolled pattern
    • chase

      public LEDPattern chase(Color color1, double percent, double speed)
      Creates an LED chase pattern with the specified color, percentage, and speed.
      Parameters:
      color1 - The color to be used in the chase pattern.
      percent - The percentage of the pattern that will be the specified color.
      speed - The speed at which the pattern will scroll, in Hertz.
      Returns:
      An LEDPattern object representing the chase pattern.
    • bounce

      public LEDPattern bounce(Color c, double durationInSeconds)
      Creates a bouncing LED pattern with the specified color and duration.
      Parameters:
      c - the color of the bouncing LED
      durationInSeconds - the duration of one complete bounce cycle in seconds
      Returns:
      an LEDPattern that applies the bouncing effect to the LEDs
    • ombre

      public LEDPattern ombre(Color startColor, Color endColor)
      Creates an ombre LED pattern that transitions smoothly between two colors.
      Parameters:
      startColor - The starting color of the ombre effect.
      endColor - The ending color of the ombre effect.
      Returns:
      An LEDPattern that applies the ombre effect to the LED strip.
    • wave

      public LEDPattern wave(Color c1, Color c2, double cycleLength, double durationSecs)
      Creates a wave LED pattern that transitions between two colors over a specified cycle length of LEDs and duration.
      Parameters:
      c1 - The first color in the wave pattern.
      c2 - The second color in the wave pattern.
      cycleLength - The length of the wave cycle in terms of LEDs.
      durationSecs - The duration of the entire wave pattern in seconds.
      Returns:
      An LEDPattern that applies the wave effect to the LEDs.
    • countdown

      public LEDPattern countdown(DoubleSupplier countStartTimeSec, double durationInSeconds)
      Creates an LEDPattern that represents a countdown effect. The countdown starts from a specified time and lasts for a given duration. During the countdown, the LEDs transition from yellow to red, and progressively turn off from the end of the strip towards the beginning.
      Parameters:
      countStartTimeSec - A DoubleSupplier that provides the start time of the countdown in seconds.
      durationInSeconds - The total duration of the countdown in seconds.
      Returns:
      An LEDPattern that applies the countdown effect to the LEDs.
    • switchCountdown

      public LEDPattern switchCountdown(Color startingColor)
    • edges

      public LEDPattern edges(Color c, double length)
    • getConfig

      public SpectrumLEDs.Config getConfig()
    • getLed

      public AddressableLED getLed()
    • getLedBuffer

      public AddressableLEDBuffer getLedBuffer()
    • getLedView

      public AddressableLEDBufferView getLedView()
    • getDefaultCommand

      public Command getDefaultCommand()
      Specified by:
      getDefaultCommand in interface Subsystem
    • getCommandPriority

      public int getCommandPriority()
    • setCommandPriority

      public void setCommandPriority(int commandPriority)