10#define LED_TYPE WS2811
11#define COLOR_ORDER GRB
14#define UPDATES_PER_SECOND 100
54 ChangePalettePeriodically();
56 static uint8_t startIndex = 0;
57 startIndex = startIndex + 1;
59 FillLEDsFromPaletteColors( startIndex);
65void FillLEDsFromPaletteColors( uint8_t colorIndex)
67 uint8_t brightness = 255;
69 for(
int i = 0; i < NUM_LEDS; ++i) {
70 leds[i] =
ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
84void ChangePalettePeriodically()
86 uint8_t secondHand = (millis() / 1000) % 60;
87 static uint8_t lastSecond = 99;
89 if( lastSecond != secondHand) {
90 lastSecond = secondHand;
94 if( secondHand == 20) { SetupPurpleAndGreenPalette(); currentBlending =
LINEARBLEND; }
95 if( secondHand == 25) { SetupTotallyRandomPalette(); currentBlending =
LINEARBLEND; }
96 if( secondHand == 30) { SetupBlackAndWhiteStripedPalette(); currentBlending =
NOBLEND; }
97 if( secondHand == 35) { SetupBlackAndWhiteStripedPalette(); currentBlending =
LINEARBLEND; }
100 if( secondHand == 50) { currentPalette = myRedWhiteBluePalette_p; currentBlending =
NOBLEND; }
101 if( secondHand == 55) { currentPalette = myRedWhiteBluePalette_p; currentBlending =
LINEARBLEND; }
106void SetupTotallyRandomPalette()
108 for(
int i = 0; i < 16; ++i) {
117void SetupBlackAndWhiteStripedPalette()
130void SetupPurpleAndGreenPalette()
132 CRGB purple =
CHSV( HUE_PURPLE, 255, 255);
133 CRGB green =
CHSV( HUE_GREEN, 255, 255);
137 green, green, black, black,
138 purple, purple, black, black,
139 green, green, black, black,
140 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.
@ 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.
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)