MCPcopy Create free account
hub / github.com/FastLED/FastLED / setup

Function setup

examples/Async/Async.h:14–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12CRGB current_color = CRGB::Black;
13
14void setup() {
15 FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
16 FastLED.setBrightness(16);
17
18 // Create a task that runs every 100ms to change color
19 auto colorPicker = fl::task::every_ms(100, FL_TRACE)
20 .then([] {
21 current_color = CHSV(random8(), 255, 255);
22 });
23
24 // Create a task that runs at 60fps to update the LEDs
25 auto displayTask = fl::task::at_framerate(60, FL_TRACE)
26 .then([] {
27 fill_solid(leds, NUM_LEDS, current_color);
28 FastLED.show();
29 });
30}
31
32void loop() {
33 // Yield to allow other operations to run

Callers

nothing calls this directly

Calls 5

every_msFunction · 0.85
at_framerateFunction · 0.85
fill_solidFunction · 0.50
setBrightnessMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected