FastLED 3.9.15
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[NUM_LEDS]
#define NUM_LEDS
#define DATA_PIN
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:74
WS2812B controller class.
Definition FastLED.h:236
task & then(function< void()> on_then)
Definition task.cpp:188
static task at_framerate(int fps)
Definition task.cpp:151
static task every_ms(int interval_ms)
Definition task.cpp:143
void fill_solid(struct CRGB *targetArray, int numToFill, const struct CRGB &color)
Fill a range of LEDs with a solid color.
Definition fill.cpp:9
@ GRB
Green, Red, Blue (0102)
Definition eorder.h:16
CRGB current_color
Definition Async.h:12
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
Definition random8.h:46
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition hsv.h:15
#define FL_TRACE
A macro to capture the current source file, line number, and time.
Definition trace.h:27

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

+ Here is the call graph for this function: