11#include "fx/2d/noisepalette.hpp"
14#include "fx/fx_engine.h"
16#include "fx/2d/animartrix.hpp"
22#define COLOR_ORDER GRB
24#define MATRIX_WIDTH 100
25#define MATRIX_HEIGHT 100
26#define GRID_SERPENTINE false
28#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
68XYMap xyMap = XYMap::constructRectangularGrid(MATRIX_WIDTH, MATRIX_HEIGHT);
71Title title(
"FastLED Wasm Demo");
72Description description(
"This example combines two features of FastLED to produce a remarkable range of effects from a relatively small amount of code. This example combines FastLED's color palette lookup functions with FastLED's Perlin noise generator, and the combination is extremely powerful.");
74Slider brightness(
"Brightness", 255, 0, 255);
76Slider speed(
"Noise - Speed", 15, 1, 50);
77Checkbox changePallete(
"Noise - Auto Palette",
true);
78Slider changePalletTime(
"Noise - Time until next random Palette", 5, 1, 100);
79Slider scale(
"Noise - Scale", 20, 1, 100);
80Button changePalette(
"Noise - Next Palette");
81Button changeFx(
"Switch between Noise & Animartrix");
82NumberField fxIndex(
"Animartrix - index", 0, 0, NUM_ANIMATIONS);
93 noisePalette.setScale(scale);
94 fxEngine.
addFx(animartrix);
95 fxEngine.
addFx(noisePalette);
100 noisePalette.setSpeed(speed);
101 noisePalette.setScale(scale);
106 static int frame = 0;
109 noisePalette.changeToRandomPalette();
114 noisePalette.changeToRandomPalette();
117 static int lastFxIndex = -1;
118 if (fxIndex.value() != lastFxIndex) {
119 lastFxIndex = fxIndex;
120 animartrix.fxSet(fxIndex);
124 printf(
"fastled running\r\n");
125 printf(
"Numberfield: %f\r\n", fxIndex.value());
129 fxEngine.
draw(millis(), leds);
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
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.
Manages and renders multiple visual effects (Fx) for LED strips.
int addFx(FxRef effect)
Adds a new effect to the engine.
bool nextFx(uint16_t transition_ms=500)
Transitions to the next effect in the sequence.
bool draw(uint32_t now, CRGB *outputBuffer)
Renders the current effect or transition to the output buffer.
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
#define EVERY_N_MILLISECONDS(N)
Alias for EVERY_N_MILLIS.
#define EVERY_N_MILLISECONDS_DYNAMIC(PERIOD_FUNC)
Checks whether to execute a block of code every N milliseconds, where N is determined dynamically.
Representation of an RGB pixel (Red, Green, Blue)