FastLED 3.9.15
Loading...
Searching...
No Matches
FxEngine.ino
Go to the documentation of this file.
1
6
7#include <FastLED.h>
8using namespace fl;
9
10#if defined(__AVR__)
11// __AVR__: Not enough memory enough for the FxEngine, so skipping this example
12void setup() {}
13void loop() {}
14
15#else
16
17#include "fx/2d/noisepalette.h"
18#include "fx/2d/animartrix.hpp"
19#include "fx/fx_engine.h"
20#include "fl/ui.h"
21
22#define LED_PIN 2
23#define BRIGHTNESS 96
24#define LED_TYPE WS2811
25#define COLOR_ORDER GRB
26
27#define MATRIX_WIDTH 22
28#define MATRIX_HEIGHT 22
29
30#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
31
32#ifdef __EMSCRIPTEN__
33#define IS_SERPINTINE false
34#else
35#define IS_SERPINTINE true
36#endif
37
38
39UISlider SCALE("SCALE", 20, 20, 100);
40UISlider SPEED("SPEED", 30, 20, 100);
41
47UICheckbox switchFx("Switch Fx", true);
48
49void setup() {
50 delay(1000); // sanity delay
52 .setCorrection(TypicalLEDStrip)
53 .setScreenMap(MATRIX_WIDTH, MATRIX_HEIGHT);
54 FastLED.setBrightness(96);
55 noisePalette1.setPalettePreset(2);
56 noisePalette2.setPalettePreset(4);
59}
60
61void loop() {
62 noisePalette1.setSpeed(SPEED);
63 noisePalette1.setScale(SCALE);
64 noisePalette2.setSpeed(SPEED);
65 noisePalette2.setScale(int(SCALE) * 3 / 2); // Make the different.
67 if (switchFx) {
68 fxEngine.nextFx(500);
69 }
70 }
71 fxEngine.draw(millis(), leds);
72 FastLED.show();
73}
74
75#endif // __AVR__
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
#define COLOR_ORDER
#define LED_TYPE
#define LED_PIN
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
central include file for FastLED, defines the CFastLED class/object
#define MATRIX_HEIGHT
FxEngine fxEngine(NUM_LEDS)
XYMap xyMap
#define MATRIX_WIDTH
UISlider SPEED("SPEED", 30, 20, 100)
NoisePalette noisePalette2(xyMap)
FxEngine fxEngine(NUM_LEDS)
void setup()
Definition FxEngine.ino:49
XYMap xyMap(MATRIX_WIDTH, MATRIX_HEIGHT, IS_SERPINTINE)
UICheckbox switchFx("Switch Fx", true)
UISlider SCALE("SCALE", 20, 20, 100)
NoisePalette noisePalette1(xyMap)
#define IS_SERPINTINE
Definition FxEngine.ino:35
void loop()
Definition FxEngine.ino:61
#define SCALE
Definition Overclock.ino:63
#define SPEED
Definition Overclock.ino:69
Manages and renders multiple visual effects (Fx) for LED strips.
Definition fx_engine.h:38
@ 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:1283
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
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:54