Package org.team1540.rooster.wrappers
Class RevBlinken
- java.lang.Object
-
- edu.wpi.first.wpilibj.MotorSafety
-
- edu.wpi.first.wpilibj.PWM
-
- edu.wpi.first.wpilibj.PWMSpeedController
-
- edu.wpi.first.wpilibj.Spark
-
- org.team1540.rooster.wrappers.RevBlinken
-
- All Implemented Interfaces:
edu.wpi.first.wpilibj.PIDOutput
,edu.wpi.first.wpilibj.Sendable
,edu.wpi.first.wpilibj.SpeedController
,AutoCloseable
public class RevBlinken extends edu.wpi.first.wpilibj.Spark
Wrapper class for controlling a REV Blinken LED controller. This class is a wrapper around aSpark
instance for sending the actual PWM signals, but provides a way to set the PWM setpoint by specifying the displayed color pattern (passing aColorPattern
) instead of the raw PWM output.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RevBlinken.ColorPattern
Enum for possible color patterns according to the Blinken user manual.
-
Constructor Summary
Constructors Constructor Description RevBlinken(int channel)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
set(double manualSetpoint)
Sets the Blinken output manually.void
set(@NotNull RevBlinken.ColorPattern pattern)
Sets the light pattern.-
Methods inherited from class edu.wpi.first.wpilibj.PWMSpeedController
disable, get, getDescription, getInverted, initSendable, pidWrite, setInverted
-
Methods inherited from class edu.wpi.first.wpilibj.PWM
close, enableDeadbandElimination, getChannel, getPosition, getRaw, getRawBounds, getSpeed, setBounds, setDisabled, setPeriodMultiplier, setPosition, setRaw, setSpeed, setZeroLatch, stopMotor
-
Methods inherited from class edu.wpi.first.wpilibj.MotorSafety
check, checkMotors, feed, getExpiration, isAlive, isSafetyEnabled, setExpiration, setSafetyEnabled
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
RevBlinken
public RevBlinken(int channel)
Constructor.- Parameters:
channel
- The PWM channel that the Blinken is attached to. 0-9 are on-board, 10-19 are on the MXP port- Throws:
IndexOutOfBoundsException
- If the specified PWM channel does not exist.
-
-
Method Detail
-
set
public void set(@NotNull @NotNull RevBlinken.ColorPattern pattern)
Sets the light pattern.- Parameters:
pattern
- The pattern to use- Throws:
NullPointerException
- If pattern is null.
-
set
public void set(double manualSetpoint)
Sets the Blinken output manually.- Specified by:
set
in interfaceedu.wpi.first.wpilibj.SpeedController
- Overrides:
set
in classedu.wpi.first.wpilibj.PWMSpeedController
- Parameters:
manualSetpoint
- The manual setpoint to be sent over PWM.
-
-