Package frc.spectrumLib.leds
Class SpectrumLEDs
java.lang.Object
frc.spectrumLib.leds.SpectrumLEDs
- All Implemented Interfaces:
Subsystem,SpectrumSubsystem
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Commandprotected final LEDPatternfinal Triggerprotected final AddressableLEDprotected final AddressableLEDBufferprotected final AddressableLEDBufferViewfinal Colorfinal Color -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates an LED pattern that blinks with the specified on-time duration.Creates a bouncing LED pattern with the specified color and duration.Creates a breathing LED pattern with the specified period.Creates an LED chase pattern with the specified color, percentage, and speed.checkPriority(int priority) countdown(DoubleSupplier countStartTimeSec, double durationInSeconds) Creates an LEDPattern that represents a countdown effect.intgetLed()Creates a gradient LED pattern using the specified colors.booleanCreates an ombre LED pattern that transitions smoothly between two colors.voidperiodic()rainbow()Creates and returns a rainbow LED pattern with specified brightness and saturation.rainbow(int saturation, int value) Generates a rainbow LED pattern with the specified saturation and value.scroll(LEDPattern pattern, double speedMps) Scrolls the given LED pattern at the specified speed.voidsetCommandPriority(int commandPriority) setPattern(LEDPattern pattern) setPattern(LEDPattern pattern, int priority) voidSet up the default command for this subsystem.voidSet up the states and triggers for this subsystem.Creates a solid LED pattern with the specified color.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 anotherswitchCountdown(Color startingColor) Creates a wave LED pattern that transitions between two colors over a specified cycle length of LEDs and duration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getName, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Field Details
-
led
-
ledBuffer
-
ledView
-
defaultPattern
-
defaultCommand
-
defaultTrigger
-
purple
-
white
-
-
Constructor Details
-
SpectrumLEDs
-
-
Method Details
-
periodic
public void periodic() -
isAttached
public boolean isAttached() -
checkPriority
-
setPattern
-
setPattern
-
setupStates
public void setupStates()Description copied from interface:SpectrumSubsystemSet up the states and triggers for this subsystem. This is typically used to bind commands to SpectrumState triggers.- Specified by:
setupStatesin interfaceSpectrumSubsystem
-
setupDefaultCommand
public void setupDefaultCommand()Description copied from interface:SpectrumSubsystemSet up the default command for this subsystem. This command will run when no other command is using this subsystem.- Specified by:
setupDefaultCommandin interfaceSpectrumSubsystem
-
stripe
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
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
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
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
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
-
rainbow
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
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
Scrolls the given LED pattern at the specified speed.- Parameters:
pattern- the LEDPattern to be scrolledspeedMps- the speed at which the pattern should scroll, in meters per second- Returns:
- a new LEDPattern that represents the scrolled pattern
-
chase
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
Creates a bouncing LED pattern with the specified color and duration.- Parameters:
c- the color of the bouncing LEDdurationInSeconds- the duration of one complete bounce cycle in seconds- Returns:
- an LEDPattern that applies the bouncing effect to the LEDs
-
ombre
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
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
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
-
edges
-
getConfig
-
getLed
-
getLedBuffer
-
getLedView
-
getDefaultCommand
- Specified by:
getDefaultCommandin interfaceSubsystem
-
getCommandPriority
public int getCommandPriority() -
setCommandPriority
public void setCommandPriority(int commandPriority)
-