FastLED 3.9.15
Loading...
Searching...
No Matches
Blur2d.ino
Go to the documentation of this file.
1// UIDescription: This example shows how to blur a strip of LEDs in 2d.
2
3#include "fl/ui.h"
4#include "fl/xymap.h"
5#include <FastLED.h>
6
7using namespace fl;
8
9#define WIDTH 22
10#define HEIGHT 22
11
12#define NUM_LEDS (WIDTH * HEIGHT)
13#define BLUR_AMOUNT 172
14#define DATA_PIN 2 // Change this to match your LED strip's data pin
15#define BRIGHTNESS 255
16#define SERPENTINE true
17
19uint8_t pos = 0;
20bool toggle = false;
22
23void setup() {
25 .setScreenMap(xymap); // Necessary when using the FastLED web compiler to display properly on a web page.
26 FastLED.setBrightness(BRIGHTNESS);
27}
28
29void loop() {
30 static int x = random(WIDTH);
31 static int y = random(HEIGHT);
32 static CRGB c = CRGB(0, 0, 0);
35 x = random(WIDTH);
36 y = random(HEIGHT);
37 uint8_t r = random(255);
38 uint8_t g = random(255);
39 uint8_t b = random(255);
40 c = CRGB(r, g, b);
41 }
42 leds[xymap(x, y)] = c;
43 FastLED.show();
44 delay(20);
45}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
#define SERPENTINE
Definition Blur2d.ino:16
#define BLUR_AMOUNT
Definition Blur2d.ino:13
#define WIDTH
Definition Blur2d.ino:9
void setup()
Definition Blur2d.ino:23
XYMap xymap(WIDTH, HEIGHT, SERPENTINE)
#define HEIGHT
Definition Blur2d.ino:10
void loop()
Definition Blur2d.ino:29
uint8_t pos
Definition Blur.ino:11
bool toggle
Definition Blur.ino:12
#define BRIGHTNESS
Definition Blur.ino:8
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
central include file for FastLED, defines the CFastLED class/object
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
WS2812B controller class.
Definition FastLED.h:211
@ GRB
Green, Red, Blue (0102)
Definition eorder.h:17
void blur2d(CRGB *leds, uint8_t width, uint8_t height, fract8 blur_amount, const XYMap &xymap)
Two-dimensional blur filter.
#define EVERY_N_MILLISECONDS(N)
Alias for EVERY_N_MILLIS.
Definition lib8tion.h:1359
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:54