MCPcopy Create free account
hub / github.com/FastLED/FastLED / loop

Function loop

examples/Wave/Wave.h:74–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void loop() {
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);
89 triggerRipple(waveSim, 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}

Callers

nothing calls this directly

Calls 14

getSuperSampleFunction · 0.70
triggerRippleFunction · 0.70
randomClass · 0.50
CRGBClass · 0.50
setSpeedMethod · 0.45
setDampeningMethod · 0.45
setHalfDuplexMethod · 0.45
setSuperSampleMethod · 0.45
clickedMethod · 0.45
isPressedMethod · 0.45
updateMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected