FastLED 3.9.15
Loading...
Searching...
No Matches

◆ loop()

void loop ( )

Definition at line 29 of file RGBW.ino.

29 {
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}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
#define TIME_FACTOR_SAT
Definition RGBW.ino:19
#define TIME_FACTOR_VAL
Definition RGBW.ino:20
#define TIME_FACTOR_HUE
Definition RGBW.ino:18
uint16_t inoise16(uint32_t x, uint32_t y, uint32_t z, uint32_t t)
16-bit, fixed point implementation of Perlin's noise.
Definition noise.cpp:466
long map(long x, long in_min, long in_max, long out_min, long out_max)
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition chsv.h:16

References FastLED, inoise16(), leds, NUM_LEDS, TIME_FACTOR_HUE, TIME_FACTOR_SAT, and TIME_FACTOR_VAL.

+ Here is the call graph for this function: