FastLED 3.9.15
Loading...
Searching...
No Matches
FxEngine.ino

This sketch is fully compatible with the FastLED web compiler.

This sketch is fully compatible with the FastLED web compiler. To use it do the following:

  1. Install Fastled: pip install fastled
  2. cd into this examples page.
  3. Run the FastLED web compiler at root: fastled
  4. When the compiler is done a web page will open.
// @filter: (memory is large)
// FastLED.h must be included first to trigger precompiled headers for FastLED's build system
#include <FastLED.h>
#include "fl/ui/ui.h"
#define LED_PIN 2
#define BRIGHTNESS 96
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
#define MATRIX_WIDTH 22
#define MATRIX_HEIGHT 22
#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
#ifdef __EMSCRIPTEN__
#define IS_SERPINTINE false
#else
#define IS_SERPINTINE true
#endif
fl::UISlider SCALE("SCALE", 20, 20, 100);
fl::UISlider SPEED("SPEED", 30, 20, 100);
fl::UICheckbox switchFx("Switch Fx", true);
void setup() {
delay(1000); // sanity delay
.setCorrection(TypicalLEDStrip)
.setScreenMap(MATRIX_WIDTH, MATRIX_HEIGHT);
FastLED.setBrightness(96);
noisePalette1.setPalettePreset(2);
noisePalette2.setPalettePreset(4);
}
void loop() {
noisePalette1.setSpeed(SPEED);
noisePalette1.setScale(SCALE);
noisePalette2.setSpeed(SPEED);
noisePalette2.setScale(int(SCALE) * 3 / 2); // Make the different.
if (switchFx) {
fxEngine.nextFx(500);
}
}
FastLED.show();
}
void setup()
void loop()
#define COLOR_ORDER
#define MATRIX_HEIGHT
fl::XYMap xyMap
fl::FxEngine fxEngine(NUM_LEDS)
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
#define LED_PIN
#define MATRIX_WIDTH
#define IS_SERPINTINE
Definition simple.h:49
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::UICheckbox switchFx("Switch Fx", true)
fl::NoisePalette noisePalette2(xyMap)
fl::NoisePalette noisePalette1(xyMap)
#define SCALE
Definition Overclock.ino:68
#define SPEED
Definition Overclock.ino:74
#define LED_TYPE
Manages and renders multiple visual effects (Fx) for LED strips.
Definition fx_engine.h:33
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
Definition color.h:15
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
Definition lib8tion.h:1010
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
Demonstrates how to mix noise generation with color palettes on a 2D LED matrix.
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38
Aggregator header for the fl/ui/ family of per-element UI types.