Class Segment
Defined in File Segment.h
Inheritance Relationships
Base Type
public AnimatableObject
(Class AnimatableObject)
Class Documentation
-
class Segment : public AnimatableObject
Single segment class definition. used to store which LEDs belong to one segment and applying animations on it.
Public Types
Public Functions
-
Segment(CRGB LEDBuffer[], uint16_t indexOfFirstLEDInSegment, uint8_t segmentLength, direction Direction, CRGB segmentColor = CRGB::Black)
Construct a new Segment object.
- Parameters:
LEDBuffer – Array of all LEDs connected in one string. Substitution of this buffer is done internally
indexOfFirstLEDInSegment – Index of the first LED in the whole LED string that belongs to this segment
segmentLength – Number of LEDs which belong to this segment
Direction – Defines which way the LED segment is wired in
segmentColor – initial color of the segment
-
virtual void tick(int32_t currentState)
Set the current animation state of the segment to a defined value.
- Parameters:
currentState – The current state of the animation starting at 0, relative to it’s absolute animation length. Over and undershoot is also possible.
-
void setColor(CRGB SegmentColor)
sets the color of the segment without displaying the change
-
void updateColor(CRGB SegmentColor)
sets the color of the segment and updates it automatically in case the segment is turned on
-
void display()
Write the current animation color to all LEDs that belong to this segment. Writes to the LED buffer but relies on an external FastLED.show() call to actually write that change to the LEDs.
-
void off()
Turns off the leds of this segment but doesn’t change the stored color of the segment.
-
void updateAnimationColor(CRGB newColor)
Change tha animation color, also possible to do while an animation is in progress.
- Parameters:
newColor – new color to use in for the current segment and animation
-
Segment(CRGB LEDBuffer[], uint16_t indexOfFirstLEDInSegment, uint8_t segmentLength, direction Direction, CRGB segmentColor = CRGB::Black)