FastLED 3.9.15
Loading...
Searching...
No Matches
Blur2d.ino
Go to the documentation of this file.
1
10
11// UIDescription: This example shows how to blur a strip of LEDs in 2d.
12
13#include <Arduino.h>
14#include <FastLED.h>
15
16#include "fl/ui.h"
17#include "fl/xymap.h"
18
19
20using namespace fl;
21
22
23#if SKETCH_HAS_LOTS_OF_MEMORY
24#define WIDTH 22
25#define HEIGHT 22
26#else
27#define WIDTH 12
28#define HEIGHT 12
29#endif
30
31#define NUM_LEDS (WIDTH * HEIGHT)
32#define BLUR_AMOUNT 172
33#define DATA_PIN 2 // Change this to match your LED strip's data pin
34#define BRIGHTNESS 255
35#define SERPENTINE true
36
38uint8_t pos = 0;
39bool toggle = false;
41
42void setup() {
44 .setScreenMap(xymap); // Necessary when using the FastLED web compiler to display properly on a web page.
45 FastLED.setBrightness(BRIGHTNESS);
46 Serial.println("setup");
47}
48
49void loop() {
50 static int x = random(WIDTH);
51 static int y = random(HEIGHT);
52 static CRGB c = CRGB(0, 0, 0);
55 x = random(WIDTH);
56 y = random(HEIGHT);
57 uint8_t r = random(255);
58 uint8_t g = random(255);
59 uint8_t b = random(255);
60 c = CRGB(r, g, b);
61 }
62 leds[xymap(x, y)] = c;
63 FastLED.show();
64 delay(20);
65}
CRGB leds[NUM_LEDS]
#define NUM_LEDS
#define DATA_PIN
int y
Definition simple.h:93
int x
Definition simple.h:92
#define SERPENTINE
Definition Blur2d.ino:35
#define BLUR_AMOUNT
Definition Blur2d.ino:32
void setup()
Definition Blur2d.ino:42
XYMap xymap(WIDTH, HEIGHT, SERPENTINE)
void loop()
Definition Blur2d.ino:49
uint8_t pos
Definition Blur.ino:11
bool toggle
Definition Blur.ino:12
#define BRIGHTNESS
Definition Blur.ino:8
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:74
central include file for FastLED, defines the CFastLED class/object
#define WIDTH
Definition advanced.h:36
#define HEIGHT
Definition advanced.h:37
WS2812B controller class.
Definition FastLED.h:236
void blur2d(CRGB *leds, fl::u8 width, fl::u8 height, fract8 blur_amount, const XYMap &xymap)
Two-dimensional blur filter.
Definition blur.cpp:72
#define EVERY_N_MILLISECONDS(N)
Alias for EVERY_N_MILLIS.
Definition lib8tion.h:1221
@ GRB
Green, Red, Blue (0102)
Definition eorder.h:16
IMPORTANT!
Definition crgb.h:20
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86