You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FastLEDHub allows you to manage all of your [FastLED]([FastLED](https://github.com/FastLED/FastLED)) sketches on the ESP8266 with minimal changes to your existing code. FastLEDHub is compatible with most of the demo sketches at [atuline/FastLED-Demos](https://github.com/atuline/FastLED-Demos). It requires little knowledge about the ESP8266 platform making in an ideal playground for beginners getting started with FastLED animations.
6
+
FastLEDHub allows you to manage all of your [FastLED]([FastLED](https://github.com/FastLED/FastLED)) sketches on the ESP8266 with minimal changes to your existing code. It requires little knowledge about the ESP8266 platform making it an ideal playground for beginners getting started with FastLED animations.
7
7
8
8
## Features
9
9
10
10
- Control multiple animations via an intuitive web interface
11
-
- Use hardware inputs to cycle through animations and adjust the brightness
12
-
- Adjust the animation speed globally
13
-
- Select any constant color via the web interface
11
+
- Adjust brightness and animation speed globally
12
+
- Define color pickers to use as parameters for your animations
14
13
- Define custom numeric sliders to parameterize your animations
15
14
- Alarm: Be woken up to an animation slowly fading in
16
15
- Sunset: Automatically fade in an animation when the sun sets at your location
16
+
- Control animations and brightness using hardware inputs
17
17
- Control animations using HTTP requests for easy automation
18
18
19
19
## Demo
20
20
21
-

21
+

22
22
23
23
24
24
## Installation
@@ -71,16 +71,17 @@ Using FastLEDHub to manage your FastLED animations requires mainly three steps:
Change `NUM_LEDS`, `LED_TYPE` and `LIGHTSTRIP_PIN` according to your hardware configuration. You may notice that this is not different than setting up a regular FastLED sketch apart from using `FastLEDHub` instead of `FastLED`.
93
94
95
+
*Note:* By default FastLEDHub will apply gamma correction to the brightness value. To disable this behavior call `FastLEDHub.initialize("Project Name", false)` instead.
96
+
94
97
### Adding a new animation
95
98
96
99
Create a new animation file `Animations/ExampleAnimation.h`:
@@ -100,6 +103,8 @@ Create a new animation file `Animations/ExampleAnimation.h`:
100
103
101
104
#include<FastLEDHub.h>
102
105
106
+
extern CRGB leds[];
107
+
103
108
classExampleAnimation : publicAnimation
104
109
{
105
110
public:
@@ -122,12 +127,12 @@ public:
122
127
While creating your animation proceed as you usually would with FastLED by defining the `reset` and `loop` functions. `reset` will be called each time an animation gets started. Use this function to reset the state variables of your animation to its starting values. It will not be called when resuming the animation from the paused status. `loop` will be called repeatedly as long as the animation is running.
123
128
124
129
Keep in mind the following important differences to just using FastLED:
125
-
- The regular `setup` function is called `reset` to emphasize its purpose
126
-
-Instead of creating your own `leds`array use the existing `FastLEDHub.leds`
127
-
- Within your animation use `FastLEDHub.numLeds` instead of `NUM_LEDS`
130
+
- The regular `setup` function is called `reset` to emphasize its purpose.
131
+
-Since `leds`has already been defined in the main sketch, simply indicate its existence with `extern CRGB leds[]`.
132
+
- Within your animation use `FastLEDHub[0].size()` instead of `NUM_LEDS` to get the number of leds. If you are using multiple lightstrips change the index accordingly.
128
133
- Every time you may want to use `FastLED` use `FastLEDHub` instead. Since `FastLEDHub` inherits from `FastLED` all member functions will be available just like before. FastLEDHub just adds some stuff on top of that.
129
134
130
-
If you want to convert an existing FastLED sketch (e.g. from [atuline/FastLED-Demos](https://github.com/atuline/FastLED-Demos)), so it can be handled by FastLEDHub, those are the necessary changes you have to perform.
135
+
If you want to convert an existing FastLED sketch (e.g. from [atuline/FastLED-Demos](https://github.com/atuline/FastLED-Demos)), so it can be handled by FastLEDHub, generally those are the necessary changes you have to perform.
131
136
132
137
### Registering animations
133
138
@@ -138,47 +143,63 @@ In your main sketch include your animations and register them at the end of the
The animation name can be any unique string and will be used to identify animations in the web interface.
145
150
146
151
## Additional features
147
152
148
-
### Static color display
153
+
### Custom color pickers
154
+
155
+
FastLEDHub allows you to register multiple color pickers to use as parameters for your animations. This allows you to integrate custom colors, gradients and more.
Within the web interface FastLEDHub uses [Bootstrap icons](https://icons.getbootstrap.com/#icons) to allow you to further differentiate between color pickers. Here `paint-bucket` refers to the respective icon class.
165
+
166
+
To access those colors within your animation use
149
167
150
-
FastLEDHub allows you to display a static color in the web interface. It will be handled as a separate animation and will always have animation index `0`. This is important if you want to trigger animations using HTTP requests.
168
+
```cpp
169
+
CRGB primaryColor = FastLEDHub.getColorPicker("Primary Color")->value; // access by name
170
+
CRGB secondaryColor = FastLEDHub.getColorPicker(1)->value; // access by index
171
+
```
151
172
152
173
### Pre-defined and custom sliders
153
174
154
-
You can add custom numeric sliders of type `int16_t` to adjust variables of animations dynamically. FastLEDHub automatically adds two sliders for brightness (0-1023, default: 1023) and animation speed (0-255, default: 127). Both of these fixed sliders have been integrated tightly into FastLEDHub and don't require any further attention. Changing the brightness will apply gamma correction automatically. Adjusting the speed will affect the effective delay of `FastLEDHub.delay()` to speed up or slow down animations. To prevent this explicitly use `FastLED.delay()` or Arduino's standard `delay()`.
175
+
You can add custom numeric sliders of type `int16_t` to adjust variables of animations dynamically. FastLEDHub automatically adds two sliders for brightness (0-255, default: 127) and animation speed (0-255, default: 127). Both of these fixed sliders have been integrated tightly into FastLEDHub and don't require any further attention. By default changing the brightness will apply gamma correction automatically. Adjusting the speed will affect the effective delay of `FastLEDHub.delay()` to speed up or slow down animations. To prevent this explicitly use `FastLED.delay()`.
155
176
156
177
To add more custom sliders simply register them in the main sketch via
This example registers a slider with a range of `150-255` and step size `1` defaulting to the value `200`. Again the slider name`"Saturation"` can be any unique string identifying the slider in the web interface.
184
+
Again `"palette"` refers to an optional [Bootstrap icon](https://icons.getbootstrap.com/#icons) and the slider name can be any unique string identifying the slider in the web interface.
163
185
164
186
To access custom slider values inside of your animation use
int16_t hue = FastLEDHub.getSlider(2)->value; // access by index
190
+
int16_t saturation = FastLEDHub.getSlider("Saturation")->value; // access by name
168
191
```
169
192
193
+
*Remember:* Since FastLEDHub comes with two pre-defined sliders `Brightness` and `Speed` the first custom slider will have index `2`.
194
+
170
195
### Hardware inputs
171
196
172
-
FastLEDHub supports a potentiometer for brightness adjustments and a push button to cycle through animations. They have to be specifically enabled with
197
+
FastLEDHub supports a potentiometer for brightness adjustments and push buttons to play/pause and cycle through animations. They have to be specifically enabled with
173
198
174
199
```cpp
175
200
FastLEDHub.enablePotentiometer(potentiometerPin);
176
-
```
177
-
178
-
and
179
-
180
-
```cpp
181
201
FastLEDHub.enableToggleButton(togglePin);
202
+
FastLEDHub.enableCycleButton(cyclePin);
182
203
```
183
204
184
205
### Alarm and sunset
@@ -202,6 +223,10 @@ Most functions can be triggered via HTTP requests:
202
223
- Trigger alarm: `http://<device-ip>/alarm`
203
224
- Reset ESP8266: `http://<device-ip>/reboot`
204
225
226
+
```cpp
227
+
FastLEDHub.initialize("Project Name", true);
228
+
```
229
+
205
230
## License & Attribution
206
231
207
232
FastLEDHub is licensed under LGPL-2.1 and uses the [sunrise-sunset.org](https://sunrise-sunset.org/api) api to retrieve sunset times.
0 commit comments