26 void lazyInit()
override { start_time = millis(); }
29 CRGB *leds = context.leds;
30 if (leds ==
nullptr || mNumLeds == 0) {
44 const char *fxName(
int)
const override {
return "DemoReel100"; }
47 uint8_t current_pattern_number = 0;
49 unsigned long start_time = 0;
53 current_pattern_number =
54 (current_pattern_number + 1) % 6;
57 void runPattern(
CRGB *leds) {
58 switch (current_pattern_number) {
63 rainbowWithGlitter(leds);
80 void rainbow(
CRGB *leds) {
85 void rainbowWithGlitter(
CRGB *leds) {
91 void addGlitter(
fract8 chanceOfGlitter,
CRGB *leds) {
92 if (
random8() < chanceOfGlitter) {
97 void confetti(
CRGB *leds) {
104 void sinelon(
CRGB *leds) {
107 int pos =
beatsin16(13, 0, mNumLeds - 1);
108 leds[pos] +=
CHSV(hue, 255, 192);
111 void bpm(
CRGB *leds) {
113 uint8_t BeatsPerMinute = 62;
115 uint8_t beat =
beatsin8(BeatsPerMinute, 64, 255);
116 for (uint16_t i = 0; i < mNumLeds; i++) {
122 void juggle(
CRGB *leds) {
126 for (uint16_t i = 0; i < 8; i++) {
127 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.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Representation of an RGB pixel (Red, Green, Blue)