Package trclib.driverio
Class TrcAddressableLED
This class implements a platform independent Addressable LED device. It is intended to be extended by a platform
dependent Addressable LED device to provides platform dependent methods to set the color pattern of the LED strip.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class contains information about an LED pattern. -
Field Summary
FieldsFields inherited from class trclib.driverio.TrcPriorityIndicator
instanceName, tracer
-
Constructor Summary
ConstructorsConstructorDescriptionTrcAddressableLED
(String instanceName, int numLEDs) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionThis method gets the current set pattern.void
This method sets the color for the whole LED strip.void
setHSV
(double hue, double sat, double value) This method sets the HSV color for the whole LED strip.void
setPattern
(TrcAddressableLED.Pattern pattern) This method sets the pattern to the physical indicator device in a device dependent way.void
setRGB
(int red, int green, int blue) This method sets the RGB color for the whole LED strip.abstract void
Methods inherited from class trclib.driverio.TrcPriorityIndicator
getPatternPriority, getPatternState, getPatternState, printPatternPriorityTable, reset, resetAllPatternStates, setPatternPriorities, setPatternState, setPatternState, setPatternState, setPatternState, setPatternState, setPatternState, toString
-
Field Details
-
numLEDs
protected final int numLEDs -
currPattern
-
-
Constructor Details
-
TrcAddressableLED
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.numLEDs
- specifies the number of LEDs in the strip.
-
-
Method Details
-
updateLED
-
setRGB
public void setRGB(int red, int green, int blue) This method sets the RGB color for the whole LED strip.- Parameters:
red
- specifies the red value (0-255).green
- specifies the green value (0-255).blue
- specifies the blue value (0-255).
-
setHSV
public void setHSV(double hue, double sat, double value) This method sets the HSV color for the whole LED strip.- Parameters:
hue
- specifies the hue (0-180).sat
- specifies the saturation (0-255).value
- specifies the value (0-255).
-
setColor
This method sets the color for the whole LED strip.- Parameters:
color
- specifies the color.
-
getPattern
This method gets the current set pattern.- Specified by:
getPattern
in classTrcPriorityIndicator<TrcAddressableLED.Pattern>
- Returns:
- currently set pattern.
-
setPattern
This method sets the pattern to the physical indicator device in a device dependent way.- Specified by:
setPattern
in classTrcPriorityIndicator<TrcAddressableLED.Pattern>
- Parameters:
pattern
- specifies the indicator pattern. If null, turn off the indicator pattern.
-