FastLED 3.9.15
Loading...
Searching...
No Matches

◆ loop()

void loop ( )

Definition at line 118 of file Parallel_IO.ino.

118 {
119 // Pattern: Rainbow on each strip (offset by time)
120 // Each strip shows a different hue
121 static uint32_t start_time = millis();
122 uint32_t elapsed = millis() - start_time;
123
124 for (int strip = 0; strip < 4; strip++) {
125 CRGB* strip_leds = nullptr;
126 switch (strip) {
127 case 0: strip_leds = leds0; break;
128 case 1: strip_leds = leds1; break;
129 case 2: strip_leds = leds2; break;
130 case 3: strip_leds = leds3; break;
131 }
132
133 if (strip_leds) {
134 uint8_t hue_offset = strip * 64; // ~90 degrees per strip
135 fill_rainbow(strip_leds, LEDS_PER_STRIP, hue_offset, 10);
136
137 // Add motion
138 uint8_t rotation = (elapsed / 50 + strip * 20) % 256;
139 rotate(strip_leds, LEDS_PER_STRIP, rotation);
140 }
141 }
142
143 // Standard FastLED.show() - all 4 strips output in parallel!
144 FastLED.show();
145
146 // Frame rate control (~50 FPS)
147 delay(20);
148
149 // Every 5 seconds, print stats
150 static uint32_t last_stats = millis();
151 if (millis() - last_stats > 5000) {
152 last_stats = millis();
153 Serial.print("Frame time: ");
154 Serial.print(elapsed);
155 Serial.println(" ms");
156 Serial.println("All 4 strips updating in parallel via automatic grouping");
157 }
158}
CRGB leds2[lengths[RedStrip]]
CRGB leds3[lengths[BlueStrip]]
CRGB leds1[lengths[GreenStrip]]
CRGB leds0[lengths[BlackStrip]]
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
#define LEDS_PER_STRIP
void rotate(CRGB *array, int length, uint8_t amount)
Helper: Rotate array elements.
void fill_rainbow(CRGB *targetArray, int numToFill, fl::u8 initialhue, fl::u8 deltahue=5) FL_NOEXCEPT
Fill a range of LEDs with a rainbow of colors.
Definition fill.cpp.hpp:29
fl::CRGB CRGB
Definition crgb.h:25
fl::u32 uint32_t
Definition s16x16x4.h:219
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Definition delay.h:98
unsigned char uint8_t
Definition s16x16x4.h:209
#define Serial
Definition serial.h:304

References FastLED, fill_rainbow(), leds0, leds1, leds2, leds3, LEDS_PER_STRIP, rotate(), and Serial.

+ Here is the call graph for this function: