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

◆ loop()

void loop ( )

Definition at line 74 of file Wave.h.

74 {
75 // Allow the waveSimulator to respond to the current slider value each frame.
76 waveSim.setSpeed(slider);
77 waveSim.setDampening(dampening);
78 // Pretty much you always want half duplex to be true, otherwise you get a gray
79 // wave effect that doesn't look good.
80 waveSim.setHalfDuplex(halfDuplex);
81 waveSim.setSuperSample(getSuperSample());
82 static int x = 0; // okay static in header
83 if (button.clicked()) {
84 // If button click then select a random position in the wave.
85 x = random(NUM_LEDS);
86 }
87 if (button.isPressed()) {
88 FL_WARN("Button is pressed at " << x);
90 }
91 waveSim.update();
92 for (int i = 0; i < extraFrames.value(); i++) {
93 waveSim.update();
94 }
95 for (int x = 0; x < NUM_LEDS; x++) {
96 // float value = waveSim.get(x);
97 uint8_t value8 = waveSim.getu8(x);
98 leds[x] = fl::CRGB(value8, value8, value8);
99 }
100 FastLED.show();
101}
#define NUM_LEDS
fl::CRGB leds[NUM_LEDS]
int x
Definition simple.h:92
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::UICheckbox halfDuplex("Half Duplex", false)
fl::WaveSimulation1D waveSim(NUM_LEDS, fl::SuperSample::SUPER_SAMPLE_2X)
fl::UISlider slider("Speed", 0.18f, 0.0f, 1.0f)
fl::UISlider extraFrames("Extra Frames", 1.0f, 0.0f, 8.0f, 1.0f)
void triggerRipple(fl::WaveSimulation1D &waveSim, int x)
Definition Wave.h:48
fl::UISlider dampening("Dampening", 6.0f, 0.0f, 10.0f, 0.1f)
fl::SuperSample getSuperSample()
Definition Wave.h:59
#define FL_WARN(X)
Definition log.h:276
fl::CRGB CRGB
Definition video.h:15
unsigned char uint8_t
Definition s16x16x4.h:209
fl::UIButton button("Button")

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

+ Here is the call graph for this function: