19#define LED_TYPE WS2811
20#define COLOR_ORDER GRB
25#define FRAMES_PER_SECOND 120
40typedef void (*SimplePatternList[])();
41SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm };
43uint8_t gCurrentPatternNumber = 0;
49 gPatterns[gCurrentPatternNumber]();
61#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
66 gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
75void rainbowWithGlitter()
82void addGlitter(
fract8 chanceOfGlitter)
84 if(
random8() < chanceOfGlitter) {
101 int pos =
beatsin16( 13, 0, NUM_LEDS-1 );
102 leds[pos] +=
CHSV( gHue, 255, 192);
108 uint8_t BeatsPerMinute = 62;
110 uint8_t beat =
beatsin8( BeatsPerMinute, 64, 255);
111 for(
int i = 0; i < NUM_LEDS; i++) {
120 for(
int i = 0; i < 8; i++) {
121 leds[
beatsin16( i+7, 0, NUM_LEDS-1 )] |=
CHSV(dothue, 200, 255);
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
void delay(unsigned long ms)
Delay for the given number of milliseconds.
void setBrightness(uint8_t scale)
Set the global brightness scaling.
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
RGB color palette with 16 discrete values.
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.
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
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)