FastLED 3.9.15
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
simple.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
27// Sketch.
28#include "src/wave.h"
29#include "src/xypaths.h"
30#include "fl/function.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
42UITitle title("Simple control of an xy path");
43UIDescription description("This is more of a test for new features.");
44
45// UIButton trigger("My Trigger");
46UISlider pointX("Point X", WIDTH / 2.0f, 0.0f, WIDTH - 1, 1.0f);
47UISlider pointY("Point Y", HEIGHT / 2.0f, 0.0f, HEIGHT - 1, 1.0f);
48
49UIButton button("second trigger");
50
51
52int x = 0;
53int y = 0;
54bool triggered = false;
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}
64void loop() {
66 triggered = button.clicked();
67 if (triggered) {
68 FASTLED_WARN("Triggered");
69 }
70 x = pointX.as_int();
71 y = pointY.as_int();
72 leds[xyMap(x, y)] = CRGB(255, 0, 0);
73
74 FastLED.show();
75}
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
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:82
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:83
#define IS_SERPINTINE
Definition FxEngine.ino:35
LED controller for WS2812 LEDs with GRB color order.
Definition FastLED.h:155
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
bool triggered
Definition simple.h:54
UISlider pointX("Point X", WIDTH/2.0f, 0.0f, WIDTH - 1, 1.0f)
void setup()
Definition simple.h:57
UISlider pointY("Point Y", HEIGHT/2.0f, 0.0f, HEIGHT - 1, 1.0f)
void loop()
Definition simple.h:64
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:55
#define FASTLED_WARN
Definition warn.h:7
UIButton button("Trigger")
UIDescription description("Advanced layered and blended wave effects.")