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

◆ setup()

void setup ( )

Definition at line 14 of file Async.h.

14 {
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([] {
28 FastLED.show();
29 });
30}
#define NUM_LEDS
fl::CRGB leds[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_NOEXCEPT
Definition task.cpp.hpp:276
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
constexpr EOrder GRB
Definition eorder.h:19
fl::hsv8 CHSV
Definition chsv.h:11
LIB8STATIC fl::u8 random8() FL_NOEXCEPT
Generate an 8-bit random number.
Definition random8.h:53
Handle every_ms(int interval_ms)
Definition task.cpp.hpp:320
Handle at_framerate(int fps)
Definition task.cpp.hpp:328
#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(), and fl::task::Handle::then().

+ Here is the call graph for this function: