FastLED 3.9.15
Loading...
Searching...
No Matches
FxAnimartrix.ino
Go to the documentation of this file.
1
10
11
12#include <stdio.h>
13#include <string>
14
15#include <FastLED.h>
16#include "fl/json.h"
17#include "fl/slice.h"
18#include "fx/fx_engine.h"
19
20#include "fx/2d/animartrix.hpp"
21#include "fl/ui.h"
22
23using namespace fl;
24
25
26#define LED_PIN 3
27#define BRIGHTNESS 96
28#define COLOR_ORDER GRB
29
30#define MATRIX_WIDTH 22
31#define MATRIX_HEIGHT 22
32
33#define NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
34
35#define FIRST_ANIMATION POLAR_WAVES
36
37
40
41
42UITitle title("Animartrix");
43UIDescription description("Demo of the Animatrix effects. @author of fx is StefanPetrick");
44
45UISlider brightness("Brightness", 255, 0, 255);
46UINumberField fxIndex("Animartrix - index", 0, 0, NUM_ANIMATIONS - 1);
47UISlider timeSpeed("Time Speed", 1, -10, 10, .1);
48
51
52void setup() {
54 .setCorrection(TypicalLEDStrip)
55 .setScreenMap(xyMap);
56 FastLED.setBrightness(brightness);
57 fxEngine.addFx(animartrix);
58}
59
60void loop() {
61 FastLED.setBrightness(brightness);
62 fxEngine.setSpeed(timeSpeed);
63 static int lastFxIndex = -1;
64 if (fxIndex.value() != lastFxIndex) {
65 lastFxIndex = fxIndex;
66 animartrix.fxSet(fxIndex);
67 }
68 fxEngine.draw(millis(), leds);
69 FastLED.show();
70}
71
72
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
#define COLOR_ORDER
#define LED_PIN
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
central include file for FastLED, defines the CFastLED class/object
XYMap xyMap(HEIGHT, WIDTH, SERPENTINE)
UISlider brightness("Brightness", 255, 0, 255, 1)
UISlider timeSpeed("Time Speed", 1, -10, 10,.1)
#define MATRIX_HEIGHT
FxEngine fxEngine(NUM_LEDS)
void setup()
UIDescription description("Demo of the Animatrix effects. @author of fx is StefanPetrick")
Animartrix animartrix(xyMap, FIRST_ANIMATION)
UISlider brightness("Brightness", 255, 0, 255)
UITitle title("Animartrix")
UINumberField fxIndex("Animartrix - index", 0, 0, NUM_ANIMATIONS - 1)
#define FIRST_ANIMATION
#define MATRIX_WIDTH
void loop()
WS2811 controller class.
Definition FastLED.h:241
Manages and renders multiple visual effects (Fx) for LED strips.
Definition fx_engine.h:38
static XYMap constructRectangularGrid(uint16_t width, uint16_t height, uint16_t offset=0)
Definition xymap.cpp:35
@ TypicalLEDStrip
Typical values for SMD5050 LEDs.
Definition color.h:19
@ NUM_ANIMATIONS
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54