FastLED
3.9.15
Loading...
Searching...
No Matches
RGBW.ino
Go to the documentation of this file.
1
2
3
#include <FastLED.h>
4
5
// How many leds in your strip?
6
#define NUM_LEDS 10
7
8
// For led chips like WS2812, which have a data line, ground, and power, you just
9
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
10
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
11
// Clock pin only needed for SPI based chipsets when not using hardware SPI
12
#define DATA_PIN 3
13
14
// Define the array of leds
15
CRGB
leds
[
NUM_LEDS
];
16
17
// Time scaling factors for each component
18
#define TIME_FACTOR_HUE 60
19
#define TIME_FACTOR_SAT 100
20
#define TIME_FACTOR_VAL 100
21
22
void
setup
() {
23
Serial
.begin(115200);
24
FastLED
.addLeds<WS2812,
DATA_PIN
,
GRB
>(
leds
,
NUM_LEDS
).setRgbw(
RgbwDefault
());
25
FastLED
.setBrightness(128);
// Set global brightness to 50%
26
delay(2000);
// If something ever goes wrong this delay will allow upload.
27
}
28
29
void
loop
() {
30
uint32_t ms = millis();
31
32
for
(
int
i = 0; i <
NUM_LEDS
; i++) {
33
// Use different noise functions for each LED and each color component
34
uint8_t
hue
=
inoise16
(ms *
TIME_FACTOR_HUE
, i * 1000, 0) >> 8;
35
uint8_t sat =
inoise16
(ms *
TIME_FACTOR_SAT
, i * 2000, 1000) >> 8;
36
uint8_t val =
inoise16
(ms *
TIME_FACTOR_VAL
, i * 3000, 2000) >> 8;
37
38
// Map the noise to full range for saturation and value
39
sat = map(sat, 0, 255, 30, 255);
40
val = map(val, 0, 255, 100, 255);
41
42
leds
[i] =
CHSV
(
hue
, sat, val);
43
}
44
45
FastLED
.show();
46
47
// Small delay to control the overall speed of the animation
48
//FastLED.delay(1);
49
50
}
NUM_LEDS
#define NUM_LEDS
Definition
Animartrix.ino:79
leds
fl::CRGB leds[NUM_LEDS]
Definition
Animartrix.ino:93
DATA_PIN
#define DATA_PIN
Definition
ClientReal.h:82
FastLED
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition
FastLED.cpp.hpp:75
TIME_FACTOR_SAT
#define TIME_FACTOR_SAT
Definition
RGBW.ino:19
setup
void setup()
Definition
RGBW.ino:22
TIME_FACTOR_VAL
#define TIME_FACTOR_VAL
Definition
RGBW.ino:20
TIME_FACTOR_HUE
#define TIME_FACTOR_HUE
Definition
RGBW.ino:18
loop
void loop()
Definition
RGBW.ino:29
hue
uint8_t hue
Definition
advanced.h:94
GRB
constexpr EOrder GRB
Definition
eorder.h:19
inoise16
fl::u16 inoise16(fl::u32 x, fl::u32 y, fl::u32 z, fl::u32 t)
Definition
noise.cpp.hpp:425
CHSV
fl::hsv8 CHSV
Definition
chsv.h:11
CRGB
fl::CRGB CRGB
Definition
crgb.h:25
RgbwDefault
Definition
rgbw.h:209
Serial
#define Serial
Definition
serial.h:304
examples
RGBW
RGBW.ino
Generated on Tue Jun 16 2026 00:06:58 for FastLED by
1.13.2