FastLED 3.10.8
Loading...
Searching...
No Matches

◆ loop()

void loop ( )

Definition at line 42 of file HSVTest.h.

42 {
43
44 uint8_t hue = hueSlider.value();
45 uint8_t saturation = saturationSlider.value();
46 uint8_t value = valueSlider.value();
47
48 if (autoHue.value()) {
49 uint32_t now = millis();
50 uint32_t hue_offset = (now / 100) % 256;
51 hue = hue_offset;
52 hueSlider.setValue(hue);
53 }
54
55 CHSV hsv(hue, saturation, value);
56
57 leds[0] = hsv2rgb_spectrum(hsv);
58 leds[2] = hsv2rgb_rainbow(hsv);
59 leds[4] = hsv2rgb_fullspectrum(hsv);
60
61 FastLED.show();
62}
CRGB leds[1]
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
UISlider saturationSlider("Saturation", 255, 0, 255, 1)
UISlider valueSlider("Value", 255, 0, 255, 1)
UICheckbox autoHue("Auto Hue", true)
UISlider hueSlider("Hue", 128, 0, 255, 1)
uint8_t hue
Definition advanced.h:94
fl::hsv8 CHSV
Definition chsv.h:11
void hsv2rgb_fullspectrum(const CHSV &hsv, CRGB &rgb) FL_NO_EXCEPT
Converts an HSV value to RGB using the algorithm from here: https://en.wikipedia.org/wiki/HSL_and_HSV...
CRGB hsv2rgb_rainbow(const CHSV &hsv) FL_NO_EXCEPT
CRGB hsv2rgb_spectrum(const CHSV &hsv) FL_NO_EXCEPT
Inline version of hsv2rgb_spectrum which returns a CRGB object.
fl::u32 uint32_t
Definition s16x16x4.h:219
fl::u32 millis() FL_NO_EXCEPT
Universal millisecond timer - returns milliseconds since system startup.
unsigned char uint8_t
Definition s16x16x4.h:209

References autoHue(), FastLED, hsv2rgb_fullspectrum(), hsv2rgb_rainbow(), hsv2rgb_spectrum(), hue, hueSlider(), leds, saturationSlider(), and valueSlider().

+ Here is the call graph for this function: