FastLED 3.9.15
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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() {
65 // FASTLED_ASSERT(false, "This is a test");
66 // leds(x,y) = CRGB(255, 0, 0);
67 float from = offset;
68 float to = length.value() + offset.value();
69 heartPath->drawColor(CRGB(255, 0, 0), from, to, &leds, steps.as_int());
70 FastLED.show();
71}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
#define WIDTH
Definition Blur2d.ino:9
#define HEIGHT
Definition Blur2d.ino:10
UITitle title("Chromancer")
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:62
central include file for FastLED, defines the CFastLED class/object
#define IS_SERPINTINE
Definition FxEngine.ino:35
LED controller for WS2812 LEDs with GRB color order.
Definition FastLED.h:155
static XYPathPtr NewHeartPath()
Definition xypath.cpp:174
UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
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)
void loop()
Definition direct.h:63
XYMap xyMap
Definition gfx.cpp:8
void clear(CRGB(&arr)[N])
Definition clear.h:13
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:55
UIDescription description("Advanced layered and blended wave effects.")