FastLED
3.10.8
Loading...
Searching...
No Matches
RGBW.ino
Go to the documentation of this file.
1
// @filter: (board is not atmega8*) // RGBW does not fit 8 KB flash (#4805)
2
3
4
#include <FastLED.h>
5
6
// Add this build flag for the real colorimetric solver:
7
// -DFASTLED_RGBW_COLORIMETRIC=1
8
// Without it, kRGBWColorimetric compiles and falls back to kRGBWExactColors.
9
10
// How many leds in your strip?
11
#define NUM_LEDS 10
12
13
// For led chips like WS2812, which have a data line, ground, and power, you just
14
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
15
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
16
// Clock pin only needed for SPI based chipsets when not using hardware SPI
17
#define DATA_PIN 3
18
19
// Define the array of leds
20
CRGB
leds
[
NUM_LEDS
];
21
22
// Time scaling factors for each component
23
#define TIME_FACTOR_HUE 60
24
#define TIME_FACTOR_SAT 100
25
#define TIME_FACTOR_VAL 100
26
27
void
setup
() {
28
Serial
.begin(115200);
29
fl::shared_ptr<const fl::color::DiodeProfile>
rgbwProfile =
30
fl::color::make_diode_profile
(
fl::color::kRgbwDefaultProfile
);
31
32
fl::Rgbw
rgbw
(
33
fl::kRGBWDefaultColorTemp
,
34
fl::RGBW_MODE::kRGBWColorimetric
,
35
fl::EOrderW::W3,
36
rgbwProfile);
37
38
FastLED
.addLeds<WS2812,
DATA_PIN
,
GRB
>(
leds
,
NUM_LEDS
).setRgbw(
rgbw
);
39
FastLED
.setBrightness(128);
// Set global brightness to 50%
40
delay(2000);
// If something ever goes wrong this delay will allow upload.
41
}
42
43
void
loop
() {
44
uint32_t ms = millis();
45
46
for
(
int
i = 0; i <
NUM_LEDS
; i++) {
47
// Use different noise functions for each LED and each color component
48
uint8_t
hue
=
inoise16
(ms *
TIME_FACTOR_HUE
, i * 1000, 0) >> 8;
49
uint8_t sat =
inoise16
(ms *
TIME_FACTOR_SAT
, i * 2000, 1000) >> 8;
50
uint8_t val =
inoise16
(ms *
TIME_FACTOR_VAL
, i * 3000, 2000) >> 8;
51
52
// Map the noise to full range for saturation and value
53
sat = map(sat, 0, 255, 30, 255);
54
val = map(val, 0, 255, 100, 255);
55
56
leds
[i] =
CHSV
(
hue
, sat, val);
57
}
58
59
FastLED
.show();
60
61
// Small delay to control the overall speed of the animation
62
//FastLED.delay(1);
63
64
}
leds
CRGB leds[1]
Definition
AnalogOutput.ino:26
NUM_LEDS
#define NUM_LEDS
Definition
Animartrix.ino:79
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:93
TIME_FACTOR_SAT
#define TIME_FACTOR_SAT
Definition
RGBW.ino:24
setup
void setup()
Definition
RGBW.ino:27
TIME_FACTOR_VAL
#define TIME_FACTOR_VAL
Definition
RGBW.ino:25
TIME_FACTOR_HUE
#define TIME_FACTOR_HUE
Definition
RGBW.ino:23
loop
void loop()
Definition
RGBW.ino:43
rgbw
Rgbw rgbw
Definition
RGBWEmulated.ino:24
hue
uint8_t hue
Definition
advanced.h:94
fl::shared_ptr
Definition
shared_ptr.h:163
GRB
constexpr EOrder GRB
Definition
eorder.h:19
inoise16
fl::u16 inoise16(fl::u32 x, fl::u32 y, fl::u32 z, fl::u32 t) FL_NO_EXCEPT
Definition
noise.cpp.hpp:463
CHSV
fl::hsv8 CHSV
Definition
chsv.h:11
CRGB
fl::CRGB CRGB
Definition
crgb.h:25
fl::color::kRgbwDefaultProfile
const DiodeProfile kRgbwDefaultProfile
Definition
rgbw.cpp.hpp:39
fl::color::make_diode_profile
fl::shared_ptr< const DiodeProfile > make_diode_profile(const DiodeProfile &profile) FL_NO_EXCEPT
Definition
rgbw.cpp.hpp:304
fl::kRGBWDefaultColorTemp
@ kRGBWDefaultColorTemp
Definition
rgbw.h:206
fl::RGBW_MODE::kRGBWColorimetric
@ kRGBWColorimetric
Definition
rgbw.h:26
fl::Rgbw
Definition
rgbw.h:227
Serial
#define Serial
Definition
serial.h:309
dox
dox
fastled
examples
RGBW
RGBW.ino
Generated on Thu Oct 22 2026 05:45:49 for FastLED by
1.13.2