FastLED 3.9.15
Loading...
Searching...
No Matches
FxEngine.ino
Go to the documentation of this file.
1
10
11#include <FastLED.h>
12using namespace fl;
13
14#if defined(__AVR__)
15// __AVR__: Not enough memory enough for the FxEngine, so skipping this example
16void setup() {}
17void loop() {}
18
19#else
20
21#include "fx/2d/noisepalette.h"
22#include "fx/2d/animartrix.hpp"
23#include "fx/fx_engine.h"
24#include "fl/ui.h"
25
26#define LED_PIN 2
27#define BRIGHTNESS 96
28#define LED_TYPE WS2811
29#define COLOR_ORDER GRB
30
31#define MATRIX_WIDTH 22
32#define MATRIX_HEIGHT 22
33
34#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
35
36#ifdef __EMSCRIPTEN__
37#define IS_SERPINTINE false
38#else
39#define IS_SERPINTINE true
40#endif
41
42
43UISlider SCALE("SCALE", 20, 20, 100);
44UISlider SPEED("SPEED", 30, 20, 100);
45
51UICheckbox switchFx("Switch Fx", true);
52
53void setup() {
54 delay(1000); // sanity delay
56 .setCorrection(TypicalLEDStrip)
57 .setScreenMap(MATRIX_WIDTH, MATRIX_HEIGHT);
58 FastLED.setBrightness(96);
59 noisePalette1.setPalettePreset(2);
60 noisePalette2.setPalettePreset(4);
63}
64
65void loop() {
66 noisePalette1.setSpeed(SPEED);
67 noisePalette1.setScale(SCALE);
68 noisePalette2.setSpeed(SPEED);
69 noisePalette2.setScale(int(SCALE) * 3 / 2); // Make the different.
71 if (switchFx) {
72 fxEngine.nextFx(500);
73 }
74 }
75 fxEngine.draw(millis(), leds);
76 FastLED.show();
77}
78
79#endif // __AVR__
CRGB leds[NUM_LEDS]
#define NUM_LEDS
#define IS_SERPINTINE
Definition simple.h:50
fl::XYMap xyMap
Definition ColorBoost.h:61
#define MATRIX_HEIGHT
Definition EaseInOut.h:19
#define MATRIX_WIDTH
Definition EaseInOut.h:18
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
UISlider SPEED("SPEED", 30, 20, 100)
NoisePalette noisePalette2(xyMap)
FxEngine fxEngine(NUM_LEDS)
void setup()
Definition FxEngine.ino:53
XYMap xyMap(MATRIX_WIDTH, MATRIX_HEIGHT, IS_SERPINTINE)
UICheckbox switchFx("Switch Fx", true)
UISlider SCALE("SCALE", 20, 20, 100)
NoisePalette noisePalette1(xyMap)
void loop()
Definition FxEngine.ino:65
#define COLOR_ORDER
Definition advanced.h:42
#define LED_TYPE
Definition advanced.h:41
#define LED_PIN
Definition advanced.h:40
Manages and renders multiple visual effects (Fx) for LED strips.
Definition fx_engine.h:33
fl::unique_ptr< FxEngine > fxEngine
Definition curr.h:299
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
Definition color.h:19
#define EVERY_N_SECONDS(N)
Checks whether to execute a block of code every N seconds.
Definition lib8tion.h:1186
IMPORTANT!
Definition crgb.h:20
Demonstrates how to mix noise generation with color palettes on a 2D LED matrix.
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86
#define SCALE
Definition wasm_impl.h:65
#define SPEED
Definition wasm_impl.h:71