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

◆ loop()

void loop ( )

Definition at line 75 of file Wave.ino.

75 {
76 // Allow the waveSimulator to respond to the current slider value each frame.
77 waveSim.setSpeed(slider);
78 waveSim.setDampening(dampening);
79 // Pretty much you always want half duplex to be true, otherwise you get a gray
80 // wave effect that doesn't look good.
81 waveSim.setHalfDuplex(halfDuplex);
82 waveSim.setSuperSample(getSuperSample());
83 static int x = 0;
84 if (button.clicked()) {
85 // If button click then select a random position in the wave.
86 x = random() % NUM_LEDS;
87 }
88 if (button.isPressed()) {
89 FASTLED_WARN("Button is pressed at " << x);
91 }
92 waveSim.update();
93 for (int i = 0; i < extraFrames.value(); i++) {
94 waveSim.update();
95 }
96 for (int x = 0; x < NUM_LEDS; x++) {
97 // float value = waveSim.get(x);
98 uint8_t value8 = waveSim.getu8(x);
99 leds[x] = CRGB(value8, value8, value8);
100 }
101 FastLED.show();
102}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
#define NUM_LEDS
Definition Apa102.ino:6
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:62
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:82
UISlider slider("Speed", 0.18f, 0.0f, 1.0f)
UISlider dampening("Dampening", 6.0f, 0.0f, 10.0f, 0.1f)
UICheckbox halfDuplex("Half Duplex", false)
SuperSample getSuperSample()
Definition Wave.ino:60
WaveSimulation1D waveSim(NUM_LEDS, SuperSample::SUPER_SAMPLE_2X)
UISlider extraFrames("Extra Frames", 1.0f, 0.0f, 8.0f, 1.0f)
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:55
#define FASTLED_WARN
Definition warn.h:7
UIButton button("Trigger")
void triggerRipple()
Definition wavefx.cpp:147

References button, dampening, extraFrames, FastLED, FASTLED_WARN, getSuperSample(), halfDuplex, leds, NUM_LEDS, slider, triggerRipple(), waveSim, and x.

+ Here is the call graph for this function: