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/draw_visitor.h"
20#include "fl/math_macros.h"
21#include "fl/raster.h"
22#include "fl/time_alpha.h"
23#include "fl/ui.h"
24#include "fl/xypath.h"
25#include "fx/time.h"
26#include "fl/leds.h"
27
28#include "src/xypaths.h"
29
30// Sketch.
31#include "src/wave.h"
32#include "src/xypaths.h"
33#include "fl/function.h"
34
35
36using namespace fl;
37
38#define HEIGHT 64
39#define WIDTH 64
40#define NUM_LEDS ((WIDTH) * (HEIGHT))
41#define IS_SERPINTINE true
42#define TIME_ANIMATION 1000 // ms
43
46UITitle title("Simple control of an xy path");
47UIDescription description("This is more of a test for new features.");
48
49// UIButton trigger("My Trigger");
50UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f);
51UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f);
52UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f);
53
55
56void setup() {
57 Serial.begin(115200);
58 auto screenmap = xyMap.toScreenMap();
59 screenmap.setDiameter(.2);
60 FastLED.addLeds<NEOPIXEL, 2>(leds, NUM_LEDS).setScreenMap(screenmap);
61}
62
63void loop() {
64 // leds(x,y) = CRGB(255, 0, 0);
66 float from = offset;
67 float to = length.value() + offset.value();
68 heartPath->drawColor(CRGB(255, 0, 0), from, to, &leds, steps.as_int());
69 FastLED.show();
70}
CRGB leds[NUM_LEDS]
#define NUM_LEDS
#define IS_SERPINTINE
Definition simple.h:50
fl::XYMap xyMap
Definition ColorBoost.h:61
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
#define WIDTH
Definition advanced.h:36
#define HEIGHT
Definition advanced.h:37
LED controller for WS2812 LEDs with GRB color order.
Definition FastLED.h:158
static XYPathPtr NewHeartPath()
Definition xypath.cpp:175
UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
UITitle title("Simple control of an xy path")
UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f)
XYPathPtr heartPath
Definition direct.h:54
void setup()
Definition direct.h:56
UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
UIDescription description("This is more of a test for new features.")
void loop()
Definition direct.h:63
void clear(CRGB(&arr)[N])
Definition clear.h:13
IMPORTANT!
Definition crgb.h:20
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86