FastLED 3.9.15
Loading...
Searching...
No Matches
Blur.ino
Go to the documentation of this file.
1// UIDescription: This example shows how to blur a strip of LEDs. It uses the blur1d function to blur the strip and fadeToBlackBy to dim the strip. A bright pixel moves along the strip.
2// Author: Zach Vorhies
3
4#include <FastLED.h>
5
6#define NUM_LEDS 64
7#define DATA_PIN 3 // Change this to match your LED strip's data pin
8#define BRIGHTNESS 255
9
11uint8_t pos = 0;
12bool toggle = false;
13
14void setup() {
15 FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
16 FastLED.setBrightness(BRIGHTNESS);
17}
18
19void loop() {
20 // Add a bright pixel that moves
21 leds[pos] = CHSV(pos * 2, 255, 255);
22 // Blur the entire strip
23 blur1d(leds, NUM_LEDS, 172);
25 FastLED.show();
26 // Move the position of the dot
27 if (toggle) {
28 pos = (pos + 1) % NUM_LEDS;
29 }
30 toggle = !toggle;
31 delay(20);
32}
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
#define BRIGHTNESS
uint8_t pos
Definition Blur.ino:11
void setup()
Definition Blur.ino:14
bool toggle
Definition Blur.ino:12
void loop()
Definition Blur.ino:19
#define DATA_PIN
Definition ClientReal.h:82
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
void fadeToBlackBy(CRGB *leds, fl::u16 num_leds, fl::u8 fadeBy)
void blur1d(fl::span< CRGB > leds, fract8 blur_amount) FL_NOEXCEPT
Definition blur.h:150
constexpr EOrder GRB
Definition eorder.h:19
fl::hsv8 CHSV
Definition chsv.h:11
fl::CRGB CRGB
Definition crgb.h:25