FastLED 3.9.15
Loading...
Searching...
No Matches
direct.h
Go to the documentation of this file.
1
2
3/*
4This demo is best viewed using the FastLED compiler.
5
6Windows/MacOS binaries: https://github.com/FastLED/FastLED/releases
7
8Python
9
10Install: pip install fastled
11Run: fastled <this sketch directory>
12This will compile and preview the sketch in the browser, and enable
13all the UI elements you see below.
14*/
15
16#include <Arduino.h>
17#include <FastLED.h>
18
19#include "fl/gfx/draw_visitor.h"
20#include "fl/math/math.h"
21#include "fl/gfx/raster.h"
22#include "fl/math/time_alpha.h"
23#include "fl/ui/ui.h"
24#include "fl/gfx/xypath.h"
25#include "fl/fx/time.h"
26#include "fl/gfx/leds.h"
27
28#include "src/xypaths.h"
29
30// Sketch.
31#include "src/wave.h"
32#include "src/xypaths.h"
33#include "fl/stl/function.h"
34
35
36
37#define HEIGHT 64
38#define WIDTH 64
39#define NUM_LEDS ((WIDTH) * (HEIGHT))
40#define IS_SERPINTINE true
41#define TIME_ANIMATION 1000 // ms
42
45fl::UITitle title("Simple control of an xy path");
46fl::UIDescription description("This is more of a test for new features.");
47
48// fl::UIButton trigger("My Trigger");
49fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f);
50fl::UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f);
51fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f);
52
54
55void setup() {
56 Serial.begin(115200);
57 auto screenmap = xyMap.toScreenMap();
58 screenmap.setDiameter(.2);
59 FastLED.addLeds<NEOPIXEL, 2>(leds, NUM_LEDS).setScreenMap(screenmap);
60}
61
62void loop() {
63 // leds(x,y) = fl::CRGB(255, 0, 0);
65 float from = offset;
66 float to = length.value() + offset.value();
67 heartPath->drawColor(fl::CRGB(255, 0, 0), from, to, &leds, steps.as_int());
68 FastLED.show();
69}
fl::XYMap xyMap
#define NUM_LEDS
fl::UIDescription description("Demo of the Animatrix effects. @author of fx is StefanPetrick")
fl::UITitle title("Animartrix")
fl::CRGB leds[NUM_LEDS]
fl::ScreenMap screenmap
#define IS_SERPINTINE
Definition simple.h:49
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
#define WIDTH
#define HEIGHT
static XYPathPtr NewHeartPath()
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
fl::XYPathPtr heartPath
Definition direct.h:53
void setup()
Definition direct.h:55
fl::UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f)
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
void loop()
Definition direct.h:62
void clear(CRGB(&arr)[N])
Definition clear.h:12
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38
#define Serial
Definition serial.h:304
Aggregator header for the fl/ui/ family of per-element UI types.