FastLED 3.10.8
Loading...
Searching...
No Matches

◆ setup()

void setup ( )

Definition at line 14 of file Async.h.

14 {
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([] {
28 FastLED.show();
29 });
30}
CRGB leds[1]
#define NUM_LEDS
CRGB current_color
Definition Async.h:12
#define DATA_PIN
Definition ClientReal.h:82
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Handle & then(function< void()> on_then) FL_NO_EXCEPT
Sets the callback invoked when the task runs successfully.
Definition task.cpp.hpp:276
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NO_EXCEPT
Fill a range of LEDs with a solid color.
Definition fill.cpp.hpp:10
constexpr EOrder GRB
Definition eorder.h:19
fl::hsv8 CHSV
Definition chsv.h:11
LIB8STATIC fl::u8 random8() FL_NO_EXCEPT
Generate an 8-bit random number.
Definition random8.h:53
Handle at_framerate(int fps) FL_NO_EXCEPT
Creates a task that runs at a fixed frame rate.
Definition task.cpp.hpp:328
Handle every_ms(int interval_ms) FL_NO_EXCEPT
Creates a task that runs at a fixed millisecond interval.
Definition task.cpp.hpp:320
#define FL_TRACE
A macro to capture the current source file, line number, and time.
Definition trace.h:102

References fl::task::at_framerate(), current_color, DATA_PIN, fl::task::every_ms(), FastLED, fill_solid(), FL_TRACE, GRB, leds, NUM_LEDS, random8(), fl::task::Handle::then(), and WS2812B.

+ Here is the call graph for this function: