A LedGroup owns a set of LedStrand pointers and fans every animation command out to all of them simultaneously. Each group runs its own PROS task, multiple independent groups are fully supported with no shared state between them.
Setup
void initialize() {
groupRight.
add(&strand3);
}
Owns a set of LedStrand pointers and fans all animation commands out to each strand simultaneously.
Definition led_group.hpp:39
void add(LedStrand *strand)
Register a strand with this group.
void init(uint32_t refreshMs=20)
Initialize hardware on all registered strands.
void start()
Start the group refresh task.
Driver for a single WS2812B-compatible LED strip on a VEX ADI port.
Definition led_strand.hpp:53
Top-level convenience header, includes the full hitlib public API.
Fan-out behaviour
Every animation method on LedGroup calls the same method on each strand in order. All strands receive the command before any of them tick, so they stay in sync.
groupRight.
pulse(0xFF0000, 5, 1);
void pulse(uint32_t color, uint8_t runLength, uint8_t speed, uint32_t bgColor=0x000000, bool invert=false, bool bounce=false)
Animate a run of color moving across a background.
void rainbow(uint8_t speed)
Scroll a full HSV rainbow across the strip.
Targeting individual strands
Use the subscript operator to reach a specific strand when you need different animations within the same group:
void setBrightness(uint8_t pct)
Set global brightness for this strand.
void setColor(uint32_t color)
Set all LEDs to a solid color.
refresh rate
init() accepts an optional refresh interval in milliseconds (default 20 ms = 50 Hz).
Pass 0 to fall back to each strand's own configured interval.
Multiple groups example
void initialize() {
drivetrainLeds.
add(&strand1);
drivetrainLeds.
add(&strand2);
intakeLeds.
add(&strand3);
}
void opcontrol() {
intakeLeds.
twinkle({0x00FFFF, 0xFFFFFF}, 40);
}
void twinkle(const std::vector< uint32_t > &colors, uint8_t densityPct=30, uint8_t fadeStep=16, uint32_t bgColor=0x000000)
Spawn randomly fading sparkles from a color palette.