Package edu.wpi.first.wpilibj
Class AddressableLEDBuffer
java.lang.Object
edu.wpi.first.wpilibj.AddressableLEDBuffer
Buffer storage for Addressable LEDs.
-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj.LEDReader
LEDReader.IndexedColorIterator
-
Constructor Summary
ConstructorDescriptionAddressableLEDBuffer
(int length) Constructs a new LED buffer with the specified length. -
Method Summary
Modifier and TypeMethodDescriptioncreateView
(int startingIndex, int endingIndex) Creates a view of a subsection of this data buffer, starting from (and including)startingIndex
and ending on (and including)endingIndex
.int
getBlue
(int index) Gets the blue channel of the color at the specified index.int
getGreen
(int index) Gets the green channel of the color at the specified index.int
Gets the buffer length.int
getRed
(int index) Gets the red channel of the color at the specified index.void
setRGB
(int index, int r, int g, int b) Sets a specific led in the buffer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj.LEDReader
forEach, getLED, getLED8Bit
-
Constructor Details
-
AddressableLEDBuffer
Constructs a new LED buffer with the specified length.- Parameters:
length
- The length of the buffer in pixels
-
-
Method Details
-
setRGB
Sets a specific led in the buffer. -
getLength
Gets the buffer length. -
getRed
Gets the red channel of the color at the specified index. -
getGreen
Gets the green channel of the color at the specified index. -
getBlue
Gets the blue channel of the color at the specified index. -
createView
Creates a view of a subsection of this data buffer, starting from (and including)startingIndex
and ending on (and including)endingIndex
. Views cannot be written directly to anAddressableLED
, but are useful tools for logically separating different sections of an LED strip for independent control.- Parameters:
startingIndex
- the first index in this buffer that the view should encompass (inclusive)endingIndex
- the last index in this buffer that the view should encompass (inclusive)- Returns:
- the view object
-