20FASTLED_SMART_PTR(DemoReel100);
27 CRGB *leds = context.leds;
28 if (leds ==
nullptr || mNumLeds == 0) {
31 if (start_time == 0) {
32 start_time = millis();
45 fl::Str fxName()
const override {
return "DemoReel100"; }
48 uint8_t current_pattern_number = 0;
50 unsigned long start_time = 0;
54 current_pattern_number =
55 (current_pattern_number + 1) % 6;
58 void runPattern(
CRGB *leds) {
59 switch (current_pattern_number) {
64 rainbowWithGlitter(leds);
81 void rainbow(
CRGB *leds) {
86 void rainbowWithGlitter(
CRGB *leds) {
92 void addGlitter(
fract8 chanceOfGlitter,
CRGB *leds) {
93 if (
random8() < chanceOfGlitter) {
98 void confetti(
CRGB *leds) {
105 void sinelon(
CRGB *leds) {
108 int pos =
beatsin16(13, 0, mNumLeds - 1);
109 leds[pos] +=
CHSV(hue, 255, 192);
112 void bpm(
CRGB *leds) {
114 uint8_t BeatsPerMinute = 62;
116 uint8_t beat =
beatsin8(BeatsPerMinute, 64, 255);
117 for (uint16_t i = 0; i < mNumLeds; i++) {
123 void juggle(
CRGB *leds) {
127 for (uint16_t i = 0; i < 8; i++) {
128 leds[
beatsin16(i + 7, 0, mNumLeds - 1)] |=
CHSV(dothue, 200, 255);
central include file for FastLED, defines the CFastLED class/object
RGB color palette with 16 discrete values.
void draw(DrawContext context) override
LIB8STATIC uint16_t beatsin16(accum88 beats_per_minute, uint16_t lowest=0, uint16_t highest=65535, uint32_t timebase=0, uint16_t phase_offset=0)
Generates a 16-bit sine wave at a given BPM that oscillates within a given range.
LIB8STATIC uint8_t beatsin8(accum88 beats_per_minute, uint8_t lowest=0, uint8_t highest=255, uint32_t timebase=0, uint8_t phase_offset=0)
Generates an 8-bit sine wave at a given BPM that oscillates within a given range.
void fadeToBlackBy(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
Reduce the brightness of an array of pixels all at once.
void fill_rainbow(struct CRGB *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue)
Fill a range of LEDs with a rainbow of colors.
uint8_t fract8
ANSI: unsigned short _Fract.
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
Get a color from a palette.
const TProgmemRGBPalette16 PartyColors_p
HSV color ramp: blue, purple, pink, red, orange, yellow (and back).
LIB8STATIC uint16_t random16()
Generate a 16-bit random number.
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
#define EVERY_N_MILLISECONDS(N)
Alias for EVERY_N_MILLIS.
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Representation of an RGB pixel (Red, Green, Blue)