10#define LED_TYPE WS2811
11#define COLOR_ORDER GRB
14#define UPDATES_PER_SECOND 100
46void ChangePalettePeriodically();
47void FillLEDsFromPaletteColors(uint8_t colorIndex);
48void SetupPurpleAndGreenPalette();
49void SetupTotallyRandomPalette();
50void SetupBlackAndWhiteStripedPalette();
65 ChangePalettePeriodically();
67 static uint8_t startIndex = 0;
68 startIndex = startIndex + 1;
70 FillLEDsFromPaletteColors( startIndex);
76void FillLEDsFromPaletteColors( uint8_t colorIndex)
78 uint8_t brightness = 255;
80 for(
int i = 0; i < NUM_LEDS; ++i) {
81 leds[i] =
ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
95void ChangePalettePeriodically()
97 uint8_t secondHand = (millis() / 1000) % 60;
98 static uint8_t lastSecond = 99;
100 if( lastSecond != secondHand) {
101 lastSecond = secondHand;
105 if( secondHand == 20) { SetupPurpleAndGreenPalette(); currentBlending =
LINEARBLEND; }
106 if( secondHand == 25) { SetupTotallyRandomPalette(); currentBlending =
LINEARBLEND; }
107 if( secondHand == 30) { SetupBlackAndWhiteStripedPalette(); currentBlending =
NOBLEND; }
108 if( secondHand == 35) { SetupBlackAndWhiteStripedPalette(); currentBlending =
LINEARBLEND; }
111 if( secondHand == 50) { currentPalette = myRedWhiteBluePalette_p; currentBlending =
NOBLEND; }
112 if( secondHand == 55) { currentPalette = myRedWhiteBluePalette_p; currentBlending =
LINEARBLEND; }
117void SetupTotallyRandomPalette()
119 for(
int i = 0; i < 16; ++i) {
128void SetupBlackAndWhiteStripedPalette()
141void SetupPurpleAndGreenPalette()
148 green, green, black, black,
149 purple, purple, black, black,
150 green, green, black, black,
151 purple, purple, black, black );
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.
#define TProgmemPalette16
Alias for TProgmemRGBPalette16.
#define FL_PROGMEM
PROGMEM keyword for storage.
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
void fill_solid(struct CRGB *targetArray, int numToFill, const struct CRGB &color)
Fill a range of LEDs with a solid color.
TBlendType
Color interpolation options for palette.
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
Get a color from a palette.
@ NOBLEND
No interpolation between palette entries.
@ LINEARBLEND
Linear interpolation between palette entries, with wrap-around from end to the beginning again.
@ HUE_PURPLE
Purple (270°)
const TProgmemRGBPalette16 RainbowStripeColors_p
HSV Rainbow colors with alternatating stripes of black.
const TProgmemRGBPalette16 CloudColors_p
Cloudy color palette.
const TProgmemRGBPalette16 PartyColors_p
HSV color ramp: blue, purple, pink, red, orange, yellow (and back).
const TProgmemRGBPalette16 RainbowColors_p
HSV Rainbow.
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Representation of an RGB pixel (Red, Green, Blue)