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.
5Install: pip install fastled
6Run: fastled <this sketch directory>
7This will compile and preview the sketch in the browser, and enable
8all the UI elements you see below.
9*/
10
11#include <Arduino.h>
12#include <FastLED.h>
13
14#include "fl/draw_visitor.h"
15#include "fl/math_macros.h"
16#include "fl/raster.h"
17#include "fl/time_alpha.h"
18#include "fl/ui.h"
19#include "fl/xypath.h"
20#include "fx/time.h"
21#include "fl/leds.h"
22
23#include "src/xypaths.h"
24
25// Sketch.
26#include "src/wave.h"
27#include "src/xypaths.h"
28#include "fl/function.h"
29
30#include <assert.h>
31
32using namespace fl;
33
34#define HEIGHT 64
35#define WIDTH 64
36#define NUM_LEDS ((WIDTH) * (HEIGHT))
37#define IS_SERPINTINE true
38#define TIME_ANIMATION 1000 // ms
39
40// CRGB leds[NUM_LEDS];
41
44UITitle title("Simple control of an xy path");
45UIDescription description("This is more of a test for new features.");
46
47// UIButton trigger("My Trigger");
48UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f);
49UISlider steps("Steps", 100.0f, 1.0f, 200.0f, 1.0f);
50UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f);
51
52
54
55
56
57void setup() {
58 Serial.begin(115200);
59 auto screenmap = xyMap.toScreenMap();
60 screenmap.setDiameter(.2);
61 FastLED.addLeds<NEOPIXEL, 2>(leds, NUM_LEDS).setScreenMap(screenmap);
62
63}
64
65
66void loop() {
68
69 // FASTLED_ASSERT(false, "This is a test");
70
71 // leds(x,y) = CRGB(255, 0, 0);
72 float from = offset;
73 float to = length.value() + offset.value();
74
75 heartPath->drawColor(CRGB(255, 0, 0), from, to, &leds, steps.as_int());
76
77
78 FastLED.show();
79}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
UITitle title("Simple control of an xy path")
#define WIDTH
Definition Audio.ino:33
#define IS_SERPINTINE
Definition Audio.ino:35
UIDescription description("This is more of a test for new features.")
#define HEIGHT
Definition Audio.ino:32
XYMap xyMap(WIDTH, HEIGHT, false)
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
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:53
void setup()
Definition direct.h:57
UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
void loop()
Definition direct.h:66
void clear(CRGB(&arr)[N])
Definition clear.h:8
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