13#if !SKETCH_HAS_LOTS_OF_MEMORY
24#define LED_TYPE WS2811
25#define COLOR_ORDER GRB
66#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
69#define MAX_DIMENSION ((kMatrixWidth>kMatrixHeight) ? kMatrixWidth : kMatrixHeight)
105uint8_t colorLoop = 1;
112void SetupRandomPalette();
115void ChangePaletteAndSettingsPeriodically();
116void mapNoiseToLEDsUsingPalette();
117uint16_t
XY( uint8_t
x, uint8_t
y);
147 uint8_t dataSmoothing = 0;
152 dataSmoothing = 200 - (
speed * 4);
158 int ioffset =
scale * i;
162 int joffset =
scale * j;
166 uint8_t data =
inoise8(
x + ioffset,
y + joffset,
z);
171 data =
qsub8(data, 16);
175 if( dataSmoothing ) {
176 uint8_t olddata =
noise[i][j];
180 uint8_t newdata =
scale8(olddata, dataSmoothing) +
181 scale8(data, 256 - dataSmoothing);
202void mapNoiseToLEDsUsingPalette()
205 static uint8_t ihue=0;
215 uint8_t index =
noise[j][i];
216 uint8_t bri =
noise[i][j];
253 ChangePaletteAndSettingsPeriodically();
260 mapNoiseToLEDsUsingPalette();
286#define HOLD_PALETTES_X_TIMES_AS_LONG 1
289void ChangePaletteAndSettingsPeriodically()
293 uint8_t secondHand = ((millis() / 1000) / HOLD_PALETTES_X_TIMES_AS_LONG) % 60;
294 static uint8_t lastSecond = 99;
297 if( lastSecond != secondHand) {
298 lastSecond = secondHand;
311 if( secondHand == 40) { SetupRandomPalette();
speed = 20;
scale = 20; colorLoop = 1; }
312 if( secondHand == 45) { SetupRandomPalette();
speed = 50;
scale = 50; colorLoop = 1; }
313 if( secondHand == 50) { SetupRandomPalette();
speed = 90;
scale = 90; colorLoop = 1; }
325void SetupRandomPalette()
370 green, green, black, black,
371 purple, purple, black, black,
372 green, green, black, black,
373 purple, purple, black, black );
382uint16_t
XY( uint8_t
x, uint8_t
y)
CRGBPalette16 currentPalette
void SetupPurpleAndGreenPalette()
void SetupBlackAndWhiteStripedPalette()
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
uint8_t noise[NUM_LAYERS][WIDTH][HEIGHT]
uint8_t XY(uint8_t x, uint8_t y)
#define kMatrixSerpentineLayout
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
void fill_solid(struct CRGB *targetArray, int numToFill, const struct CRGB &color)
Fill a range of LEDs with a solid color.
LIB8STATIC uint8_t dim8_raw(uint8_t x)
Adjust a scaling value for dimming.
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
LIB8STATIC_ALWAYS_INLINE uint8_t qsub8(uint8_t i, uint8_t j)
Subtract one byte from another, saturating at 0x00.
uint8_t inoise8(uint16_t x, uint16_t y, uint16_t z)
8-Bit, fixed point implementation of Perlin's noise.
@ HUE_PURPLE
Purple (270°)
const TProgmemRGBPalette16 RainbowStripeColors_p
HSV Rainbow colors with alternatating stripes of black.
const TProgmemRGBPalette16 OceanColors_p
Ocean colors, blues and whites.
const TProgmemRGBPalette16 CloudColors_p
Cloudy color palette.
const TProgmemRGBPalette16 ForestColors_p
Forest colors, greens.
const TProgmemRGBPalette16 LavaColors_p
Lava color palette.
const TProgmemRGBPalette16 PartyColors_p
HSV color ramp: blue, purple, pink, red, orange, yellow (and back).
const TProgmemRGBPalette16 RainbowColors_p
HSV Rainbow.
LIB8STATIC uint16_t random16()
Generate a 16-bit random number.
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
@ White
<div style='background:#FFFFFF;width:4em;height:4em;'></div>
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Representation of an RGB pixel (Red, Green, Blue)