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() {
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}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
uint8_t pos
Definition Blur.ino:11
void setup()
Definition Blur.ino:14
bool toggle
Definition Blur.ino:12
#define BRIGHTNESS
Definition Blur.ino:8
void loop()
Definition Blur.ino:19
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
central include file for FastLED, defines the CFastLED class/object
WS2812B controller class.
Definition FastLED.h:211
@ GRB
Green, Red, Blue (0102)
Definition eorder.h:17
void blur1d(CRGB *leds, uint16_t numLeds, fract8 blur_amount)
One-dimensional blur filter.
void fadeToBlackBy(CRGB *leds, uint16_t num_leds, uint8_t fadeBy)
Reduce the brightness of an array of pixels all at once.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54