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

◆ loop()

void loop ( )

Definition at line 58 of file RGBWW.ino.

58 {
59 // Animate a slow warm <-> cool transition. The colorimetric solver
60 // chooses the warm/cool blend per pixel based on the input chromaticity,
61 // so writing CRGB stays the same as a normal sketch — only the wire
62 // format and color science change.
63 uint32_t ms = millis();
64 uint8_t blend = sin8(ms / 16); // 0..255 triangle-ish
65
66 // Lerp between a warm white tint (255, 200, 130) and a cool one (180, 200, 255).
67 CRGB warm(255, 200, 130);
68 CRGB cool(180, 200, 255);
69 CRGB mixed;
70 mixed.r = lerp8by8(warm.r, cool.r, blend);
71 mixed.g = lerp8by8(warm.g, cool.g, blend);
72 mixed.b = lerp8by8(warm.b, cool.b, blend);
73
74 fill_solid(leds, NUM_LEDS, mixed);
75 FastLED.show();
76 delay(20);
77}
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NOEXCEPT
Fill a range of LEDs with a solid color.
Definition fill.cpp.hpp:9
fl::CRGB CRGB
Definition crgb.h:25
LIB8STATIC fl::u8 lerp8by8(fl::u8 a, fl::u8 b, fract8 frac)
Linear interpolation between two unsigned 8-bit values, with 8-bit fraction.
Definition lib8tion.h:363
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

References blend(), FastLED, fill_solid(), leds, lerp8by8(), and NUM_LEDS.

+ Here is the call graph for this function: