FastLED 3.9.15
Loading...
Searching...
No Matches
advanced.h
Go to the documentation of this file.
1
4
5#include <Arduino.h>
6#include <FastLED.h>
7
8
9
10#include "fl/ui.h"
11#include "fl/audio.h"
12#include "fl/fft.h"
13#include "fl/xymap.h"
14#include "fl/math.h"
15#include "fl/math_macros.h"
16
17#include "fl/compiler_control.h"
18
19// This is used by fastled because we have extremely strict compiler settings.
20// Stock Arduino/Platformio does not need these.
22FL_DISABLE_WARNING(float-conversion)
23FL_DISABLE_WARNING(sign-conversion)
24
25
26using namespace fl;
27
28// Display configuration
29// For WebAssembly, use a smaller display to avoid memory issues
30#ifdef __EMSCRIPTEN__
31#define WIDTH 32
32#define HEIGHT 32
33#else
34#define WIDTH 64
35#define HEIGHT 64
36#endif
37#define NUM_LEDS (WIDTH * HEIGHT)
38#define LED_PIN 3
39#define LED_TYPE WS2812B
40#define COLOR_ORDER GRB
41
42// Audio configuration
43#define SAMPLE_RATE 44100
44#define FFT_SIZE 512
45
46// UI Elements
47UITitle title("Audio Reactive Visualizations");
48UIDescription description("Real-time audio visualizations with beat detection and multiple modes");
49
50// Master controls
51UICheckbox enableAudio("Enable Audio", true);
52UIDropdown visualMode("Visualization Mode",
53 {"Spectrum Bars", "Radial Spectrum", "Waveform", "VU Meter", "Matrix Rain", "Fire Effect", "Plasma Wave"});
54
55// Audio controls
56UISlider audioGain("Audio Gain", 1.0f, 0.1f, 5.0f, 0.1f);
57UISlider noiseFloor("Noise Floor", 0.1f, 0.0f, 1.0f, 0.01f);
58UICheckbox autoGain("Auto Gain", true);
59
60// Visual controls
61UISlider brightness("Brightness", 128, 0, 255, 1);
62UISlider fadeSpeed("Fade Speed", 20, 0, 255, 1);
63UIDropdown colorPalette("Color Palette",
64 {"Rainbow", "Heat", "Ocean", "Forest", "Party", "Lava", "Cloud"});
65UICheckbox mirrorMode("Mirror Mode", false);
66
67// Beat detection
68UICheckbox beatDetect("Beat Detection", true);
69UISlider beatSensitivity("Beat Sensitivity", 1.5f, 0.5f, 3.0f, 0.1f);
70UICheckbox beatFlash("Beat Flash", true);
71
72// Audio input
73UIAudio audio("Audio Input");
74
75// Global variables
79
80// Audio processing variables - keep these smaller for WebAssembly
81static const int NUM_BANDS = 16; // Reduced from 32
82float fftSmooth[NUM_BANDS] = {0};
83float beatHistory[20] = {0}; // Reduced from 43
85float beatAverage = 0;
86float beatVariance = 0;
87uint32_t lastBeatTime = 0;
88bool isBeat = false;
89float autoGainValue = 1.0f;
90float peakLevel = 0;
91
92// Visual effect variables
93uint8_t hue = 0;
94// Remove large static arrays for WebAssembly
95#ifndef __EMSCRIPTEN__
96float plasma[WIDTH][HEIGHT] = {{0}};
97uint8_t fireBuffer[WIDTH][HEIGHT] = {{0}};
98#endif
99
100// Get current color palette
101CRGBPalette16 getCurrentPalette() {
102 switch(colorPalette.as_int()) {
103 case 0: return CRGBPalette16(RainbowColors_p);
104 case 1: return CRGBPalette16(HeatColors_p);
105 case 2: return CRGBPalette16(OceanColors_p);
106 case 3: return CRGBPalette16(ForestColors_p);
107 case 4: return CRGBPalette16(PartyColors_p);
108 case 5: return CRGBPalette16(LavaColors_p);
109 case 6: return CRGBPalette16(CloudColors_p);
110 default: return CRGBPalette16(RainbowColors_p);
111 }
112}
113
114// Beat detection algorithm
115bool detectBeat(float energy) {
118
119 // Calculate average
120 beatAverage = 0;
121 for (int i = 0; i < 20; i++) {
123 }
124 beatAverage /= 20.0f;
125
126 // Calculate variance
127 beatVariance = 0;
128 for (int i = 0; i < 20; i++) {
129 float diff = beatHistory[i] - beatAverage;
130 beatVariance += diff * diff;
131 }
132 beatVariance /= 20.0f;
133
134 // Detect beat
135 float threshold = beatAverage + (beatSensitivity.value() * sqrt(beatVariance));
136 uint32_t currentTime = millis();
137
138 if (energy > threshold && (currentTime - lastBeatTime) > 80) {
139 lastBeatTime = currentTime;
140 return true;
141 }
142 return false;
143}
144
145// Update auto gain
146void updateAutoGain(float level) {
147 if (!autoGain) {
148 autoGainValue = 1.0f;
149 return;
150 }
151
152 static float targetLevel = 0.7f;
153 static float avgLevel = 0.0f;
154
155 avgLevel = avgLevel * 0.95f + level * 0.05f;
156
157 if (avgLevel > 0.01f) {
158 float gainAdjust = targetLevel / avgLevel;
159 gainAdjust = fl::clamp(gainAdjust, 0.5f, 2.0f);
160 autoGainValue = autoGainValue * 0.9f + gainAdjust * 0.1f;
161 }
162}
163
164// Clear display
166 if (fadeSpeed.as_int() == 0) {
168 } else {
170 }
171}
172
173// Visualization: Spectrum Bars
174void drawSpectrumBars(FFTBins* fft, float /* peak */) {
175 clearDisplay();
176 CRGBPalette16 palette = getCurrentPalette();
177
178 int barWidth = WIDTH / NUM_BANDS;
179
180 for (size_t band = 0; band < NUM_BANDS && band < fft->bins_db.size(); band++) {
181 float magnitude = fft->bins_db[band];
182
183 // Apply noise floor
184 magnitude = magnitude / 100.0f; // Normalize from dB
185 magnitude = MAX(0.0f, magnitude - noiseFloor.value());
186
187 // Smooth the FFT
188 fftSmooth[band] = fftSmooth[band] * 0.8f + magnitude * 0.2f;
189 magnitude = fftSmooth[band];
190
191 // Apply gain
192 magnitude *= audioGain.value() * autoGainValue;
193 magnitude = fl::clamp(magnitude, 0.0f, 1.0f);
194
195 int barHeight = magnitude * HEIGHT;
196 int xStart = band * barWidth;
197
198 for (int x = 0; x < barWidth - 1; x++) {
199 for (int y = 0; y < barHeight; y++) {
200 uint8_t colorIndex = fl::map_range<float, uint8_t>(
201 float(y) / HEIGHT, 0, 1, 0, 255
202 );
203 CRGB color = ColorFromPalette(palette, colorIndex + hue);
204
205 int ledIndex = xyMap(xStart + x, y);
206 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
207 leds[ledIndex] = color;
208 }
209
210 if (mirrorMode) {
211 int mirrorIndex = xyMap(WIDTH - 1 - (xStart + x), y);
212 if (mirrorIndex >= 0 && mirrorIndex < NUM_LEDS) {
213 leds[mirrorIndex] = color;
214 }
215 }
216 }
217 }
218 }
219}
220
221// Visualization: Radial Spectrum
222void drawRadialSpectrum(FFTBins* fft, float /* peak */) {
223 clearDisplay();
224 CRGBPalette16 palette = getCurrentPalette();
225
226 int centerX = WIDTH / 2;
227 int centerY = HEIGHT / 2;
228
229 for (size_t angle = 0; angle < 360; angle += 6) { // Reduced resolution
230 size_t band = (angle / 6) % NUM_BANDS;
231 if (band >= fft->bins_db.size()) continue;
232
233 float magnitude = fft->bins_db[band] / 100.0f;
234 magnitude = MAX(0.0f, magnitude - noiseFloor.value());
235 magnitude *= audioGain.value() * autoGainValue;
236 magnitude = fl::clamp(magnitude, 0.0f, 1.0f);
237
238 int radius = magnitude * (MIN(WIDTH, HEIGHT) / 2);
239
240 for (int r = 0; r < radius; r++) {
241 int x = centerX + (r * cosf(angle * PI / 180.0f));
242 int y = centerY + (r * sinf(angle * PI / 180.0f));
243
244 if (x >= 0 && x < WIDTH && y >= 0 && y < HEIGHT) {
245 uint8_t colorIndex = fl::map_range<int, uint8_t>(r, 0, radius, 255, 0);
246 int ledIndex = xyMap(x, y);
247 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
248 leds[ledIndex] = ColorFromPalette(palette, colorIndex + hue);
249 }
250 }
251 }
252 }
253}
254
255// Visualization: Logarithmic Waveform (prevents saturation)
256void drawWaveform(const Slice<const int16_t>& pcm, float /* peak */) {
257 clearDisplay();
258 CRGBPalette16 palette = getCurrentPalette();
259
260 int samplesPerPixel = pcm.size() / WIDTH;
261 int centerY = HEIGHT / 2;
262
263 for (size_t x = 0; x < WIDTH; x++) {
264 size_t sampleIndex = x * samplesPerPixel;
265 if (sampleIndex >= pcm.size()) break;
266
267 // Get the raw sample value
268 float sample = float(pcm[sampleIndex]) / 32768.0f; // Normalize to -1.0 to 1.0
269
270 // Apply logarithmic scaling to prevent saturation
271 float absSample = fabsf(sample);
272 float logAmplitude = 0.0f;
273
274 if (absSample > 0.001f) { // Avoid log(0)
275 // Logarithmic compression: log10(1 + gain * sample)
276 float scaledSample = absSample * audioGain.value() * autoGainValue;
277 logAmplitude = log10f(1.0f + scaledSample * 9.0f) / log10f(10.0f); // Normalize to 0-1
278 }
279
280 // Apply smooth sensitivity curve
281 logAmplitude = powf(logAmplitude, 0.7f); // Gamma correction for better visual response
282
283 // Calculate amplitude in pixels
284 int amplitude = int(logAmplitude * (HEIGHT / 2));
285 amplitude = fl::clamp(amplitude, 0, HEIGHT / 2);
286
287 // Preserve the sign for proper waveform display
288 if (sample < 0) amplitude = -amplitude;
289
290 // Color mapping based on amplitude intensity
291 uint8_t colorIndex = fl::map_range<int, uint8_t>(abs(amplitude), 0, HEIGHT/2, 40, 255);
292 CRGB color = ColorFromPalette(palette, colorIndex + hue);
293
294 // Apply brightness scaling for low amplitudes
295 if (abs(amplitude) < HEIGHT / 4) {
296 color.fadeToBlackBy(128 - (abs(amplitude) * 512 / HEIGHT));
297 }
298
299 // Draw vertical line from center
300 if (amplitude == 0) {
301 // Draw center point for zero amplitude
302 int ledIndex = xyMap(x, centerY);
303 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
304 leds[ledIndex] = color.fadeToBlackBy(200);
305 }
306 } else {
307 // Draw line from center to amplitude
308 int startY = (amplitude > 0) ? centerY : centerY + amplitude;
309 int endY = (amplitude > 0) ? centerY + amplitude : centerY;
310
311 for (int y = startY; y <= endY; y++) {
312 if (y >= 0 && y < HEIGHT) {
313 int ledIndex = xyMap(x, y);
314 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
315 // Fade edges for smoother appearance
316 CRGB pixelColor = color;
317 if (y == startY || y == endY) {
318 pixelColor.fadeToBlackBy(100);
319 }
320 leds[ledIndex] = pixelColor;
321 }
322 }
323 }
324 }
325 }
326}
327
328// Visualization: VU Meter
329void drawVUMeter(float rms, float peak) {
330 clearDisplay();
331 CRGBPalette16 palette = getCurrentPalette();
332
333 // RMS level bar
334 int rmsWidth = rms * WIDTH * audioGain.value() * autoGainValue;
335 rmsWidth = MIN(rmsWidth, WIDTH);
336
337 for (int x = 0; x < rmsWidth; x++) {
338 for (int y = HEIGHT/3; y < 2*HEIGHT/3; y++) {
339 uint8_t colorIndex = fl::map_range<int, uint8_t>(x, 0, WIDTH, 0, 255);
340 int ledIndex = xyMap(x, y);
341 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
342 leds[ledIndex] = ColorFromPalette(palette, colorIndex);
343 }
344 }
345 }
346
347 // Peak indicator
348 int peakX = peak * WIDTH * audioGain.value() * autoGainValue;
349 peakX = MIN(peakX, WIDTH - 1);
350
351 for (int y = HEIGHT/4; y < 3*HEIGHT/4; y++) {
352 int ledIndex = xyMap(peakX, y);
353 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
354 leds[ledIndex] = CRGB::White;
355 }
356 }
357
358 // Beat indicator
359 if (isBeat && beatFlash) {
360 for (int x = 0; x < WIDTH; x++) {
361 int ledIndex1 = xyMap(x, 0);
362 int ledIndex2 = xyMap(x, HEIGHT - 1);
363 if (ledIndex1 >= 0 && ledIndex1 < NUM_LEDS) leds[ledIndex1] = CRGB::White;
364 if (ledIndex2 >= 0 && ledIndex2 < NUM_LEDS) leds[ledIndex2] = CRGB::White;
365 }
366 }
367}
368
369// Visualization: Matrix Rain
370void drawMatrixRain(float peak) {
371 // Shift everything down
372 for (int x = 0; x < WIDTH; x++) {
373 for (int y = HEIGHT - 1; y > 0; y--) {
374 int currentIndex = xyMap(x, y);
375 int aboveIndex = xyMap(x, y - 1);
376 if (currentIndex >= 0 && currentIndex < NUM_LEDS &&
377 aboveIndex >= 0 && aboveIndex < NUM_LEDS) {
378 leds[currentIndex] = leds[aboveIndex];
379 leds[currentIndex].fadeToBlackBy(40);
380 }
381 }
382 }
383
384 // Add new drops based on audio
385 int numDrops = peak * WIDTH * audioGain.value() * autoGainValue;
386 for (int i = 0; i < numDrops; i++) {
387 int x = random(WIDTH);
388 int ledIndex = xyMap(x, 0);
389 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
390 leds[ledIndex] = CHSV(96, 255, 255); // Green
391 }
392 }
393}
394
395// Visualization: Fire Effect (simplified for WebAssembly)
396void drawFireEffect(float peak) {
397 // Simple fire effect without buffer
398 clearDisplay();
399
400 // Add heat at bottom based on audio
401 int heat = 100 + (peak * 155 * audioGain.value() * autoGainValue);
402 heat = MIN(heat, 255);
403
404 for (int x = 0; x < WIDTH; x++) {
405 for (int y = 0; y < HEIGHT; y++) {
406 // Simple gradient from bottom to top
407 int heatLevel = heat * (HEIGHT - y) / HEIGHT;
408 heatLevel = heatLevel * random(80, 120) / 100; // Add randomness
409 heatLevel = MIN(heatLevel, 255);
410
411 int ledIndex = xyMap(x, y);
412 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
413 leds[ledIndex] = HeatColor(heatLevel);
414 }
415 }
416 }
417}
418
419// Visualization: Plasma Wave
420void drawPlasmaWave(float peak) {
421 static float time = 0;
422 time += 0.05f + (peak * 0.2f);
423
424 CRGBPalette16 palette = getCurrentPalette();
425
426 for (int x = 0; x < WIDTH; x++) {
427 for (int y = 0; y < HEIGHT; y++) {
428 float value = sinf(x * 0.1f + time) +
429 sinf(y * 0.1f - time) +
430 sinf((x + y) * 0.1f + time) +
431 sinf(sqrtf(x * x + y * y) * 0.1f - time);
432
433 value = (value + 4) / 8; // Normalize to 0-1
434 value *= audioGain.value() * autoGainValue;
435
436 uint8_t colorIndex = value * 255;
437 int ledIndex = xyMap(x, y);
438 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
439 leds[ledIndex] = ColorFromPalette(palette, colorIndex + hue);
440 }
441 }
442 }
443}
444
445void setup() {
446 Serial.begin(115200);
447 delay(1000);
448
449 Serial.println("Audio Reactive Visualizations");
450 Serial.println("Initializing...");
451 Serial.print("Display size: ");
452 Serial.print(WIDTH);
453 Serial.print("x");
454 Serial.println(HEIGHT);
455
456 // Initialize LEDs
458 FastLED.setBrightness(brightness.as_int());
459 FastLED.clear();
460 FastLED.show();
461
462 // Set up UI callbacks
463 brightness.onChanged([](float value) {
464 FastLED.setBrightness(value);
465 });
466
467 Serial.println("Setup complete!");
468}
469
470void loop() {
471 // Check if audio is enabled
472 if (!enableAudio) {
473 // Show a simple test pattern
475 FastLED.show();
476 delay(20);
477 return;
478 }
479
480 // Process only one audio sample per frame to avoid accumulation
481 AudioSample sample = audio.next();
482 if (sample.isValid()) {
483 // Update sound meter
484 soundMeter.processBlock(sample.pcm());
485
486 // Get audio levels
487 float rms = sample.rms() / 32768.0f;
488
489 // Calculate peak
490 int32_t maxSample = 0;
491 for (size_t i = 0; i < sample.pcm().size(); i++) {
492 int32_t absSample = fabsf(sample.pcm()[i]);
493 if (absSample > maxSample) {
494 maxSample = absSample;
495 }
496 }
497 float peak = float(maxSample) / 32768.0f;
498 peakLevel = peakLevel * 0.9f + peak * 0.1f; // Smooth peak
499
500 // Update auto gain
502
503 // Beat detection
504 if (beatDetect) {
505 isBeat = detectBeat(peak);
506 }
507
508 // Get FFT data - create local FFTBins to avoid accumulation
509 FFTBins fftBins(NUM_BANDS);
510 sample.fft(&fftBins);
511
512 // Update color animation
513 hue += 1;
514
515 // Apply beat flash
516 if (isBeat && beatFlash) {
517 for (int i = 0; i < NUM_LEDS; i++) {
518 leds[i].fadeLightBy(-50); // Make brighter
519 }
520 }
521
522 // Draw selected visualization
523 switch (visualMode.as_int()) {
524 case 0: // Spectrum Bars
525 drawSpectrumBars(&fftBins, peakLevel);
526 break;
527
528 case 1: // Radial Spectrum
529 drawRadialSpectrum(&fftBins, peakLevel);
530 break;
531
532 case 2: // Waveform
533 drawWaveform(sample.pcm(), peakLevel);
534 break;
535
536 case 3: // VU Meter
538 break;
539
540 case 4: // Matrix Rain
542 break;
543
544 case 5: // Fire Effect
546 break;
547
548 case 6: // Plasma Wave
550 break;
551 }
552 }
553
554 FastLED.show();
555
556 // Add a small delay to prevent tight loops in WebAssembly
557 #ifdef __EMSCRIPTEN__
558 delay(1);
559 #endif
560}
561
CRGB leds[NUM_LEDS]
#define NUM_LEDS
uint8_t hue
int y
Definition simple.h:93
float rms(Slice< const int16_t > data)
Definition simple.h:98
int x
Definition simple.h:92
fl::XYMap xyMap
Definition ColorBoost.h:57
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:74
central include file for FastLED, defines the CFastLED class/object
uint8_t heat[NUM_LEDS]
Definition Fire2023.h:101
UINumberField palette("Palette", 0, 0, 2)
AudioAnalyzeFFT1024 fft
#define COLOR_ORDER
Definition advanced.h:40
UISlider beatSensitivity("Beat Sensitivity", 1.5f, 0.5f, 3.0f, 0.1f)
uint32_t lastBeatTime
Definition advanced.h:87
UICheckbox beatFlash("Beat Flash", true)
void drawMatrixRain(float peak)
Definition advanced.h:370
SoundLevelMeter soundMeter(0.0, 0.0)
bool detectBeat(float energy)
Definition advanced.h:115
void drawRadialSpectrum(FFTBins *fft, float)
Definition advanced.h:222
bool isBeat
Definition advanced.h:88
#define WIDTH
Definition advanced.h:34
#define LED_TYPE
Definition advanced.h:39
static const int NUM_BANDS
Definition advanced.h:81
float fftSmooth[NUM_BANDS]
Definition advanced.h:82
void drawVUMeter(float rms, float peak)
Definition advanced.h:329
UISlider fadeSpeed("Fade Speed", 20, 0, 255, 1)
UITitle title("Audio Reactive Visualizations")
void setup()
Definition advanced.h:445
UIDescription description("Real-time audio visualizations with beat detection and multiple modes")
uint8_t fireBuffer[WIDTH][HEIGHT]
Definition advanced.h:97
void drawFireEffect(float peak)
Definition advanced.h:396
void updateAutoGain(float level)
Definition advanced.h:146
float peakLevel
Definition advanced.h:90
void drawWaveform(const Slice< const int16_t > &pcm, float)
Definition advanced.h:256
UISlider noiseFloor("Noise Floor", 0.1f, 0.0f, 1.0f, 0.01f)
void drawSpectrumBars(FFTBins *fft, float)
Definition advanced.h:174
float beatAverage
Definition advanced.h:85
UIDropdown visualMode("Visualization Mode", {"Spectrum Bars", "Radial Spectrum", "Waveform", "VU Meter", "Matrix Rain", "Fire Effect", "Plasma Wave"})
UICheckbox mirrorMode("Mirror Mode", false)
UISlider brightness("Brightness", 128, 0, 255, 1)
float beatVariance
Definition advanced.h:86
#define LED_PIN
Definition advanced.h:38
float autoGainValue
Definition advanced.h:89
UISlider audioGain("Audio Gain", 1.0f, 0.1f, 5.0f, 0.1f)
CRGBPalette16 getCurrentPalette()
Definition advanced.h:101
int beatHistoryIndex
Definition advanced.h:84
UIAudio audio("Audio Input")
float beatHistory[20]
Definition advanced.h:83
UICheckbox beatDetect("Beat Detection", true)
UICheckbox autoGain("Auto Gain", true)
#define HEIGHT
Definition advanced.h:35
float plasma[WIDTH][HEIGHT]
Definition advanced.h:96
void drawPlasmaWave(float peak)
Definition advanced.h:420
UICheckbox enableAudio("Enable Audio", true)
UIDropdown colorPalette("Color Palette", {"Rainbow", "Heat", "Ocean", "Forest", "Party", "Lava", "Cloud"})
void clearDisplay()
Definition advanced.h:165
void loop()
Definition advanced.h:470
const VectorPCM & pcm() const
Definition audio.cpp:62
bool isValid() const
Definition audio.h:36
void fft(FFTBins *out) const
Definition audio.cpp:173
float rms() const
Definition audio.cpp:128
fl::size size() const
Definition slice.h:142
void fadeToBlackBy(CRGB *leds, fl::u16 num_leds, fl::u8 fadeBy)
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
void fill_rainbow(struct CRGB *targetArray, int numToFill, fl::u8 initialhue, fl::u8 deltahue=5)
Fill a range of LEDs with a rainbow of colors.
Definition fill.cpp:29
CRGB HeatColor(fl::u8 temperature)
void fill_solid(struct CRGB *targetArray, int numToFill, const struct CRGB &color)
Fill a range of LEDs with a solid color.
Definition fill.cpp:9
#define FL_DISABLE_WARNING(warning)
#define FL_DISABLE_WARNING_PUSH
#define FL_DISABLE_WARNING_POP
const TProgmemRGBPalette16 OceanColors_p
Ocean colors, blues and whites.
const TProgmemRGBPalette16 CloudColors_p
Cloudy color palette.
const TProgmemRGBPalette16 HeatColors_p
Approximate "black body radiation" palette, akin to the FastLED HeatColor() function.
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.
#define MIN(a, b)
Definition math_macros.h:49
#define PI
Definition math_macros.h:97
#define MAX(a, b)
Definition math_macros.h:45
FASTLED_FORCE_INLINE T clamp(T value, T min, T max)
Definition clamp.h:10
fl::u32 time()
Universal millisecond timer - returns milliseconds since system startup.
Definition time.cpp:136
IMPORTANT!
Definition crgb.h:20
CRGB & fadeToBlackBy(fl::u8 fadefactor)
fadeToBlackBy is a synonym for nscale8(), as a fade instead of a scale
@ White
<div style='background:#FFFFFF;width:4em;height:4em;'></div>
Definition crgb.h:703
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:567
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition hsv.h:15