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

Function loop

examples/Fx/Particles1d/Particles1d.h:52–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52void loop() {
53 uint32_t now = fl::millis();
54
55 // Update effect parameters from UI
56 FastLED.setBrightness(uiBrightness.as<int>());
57 particles.setSpeed(uiSpeed.as<float>());
58 particles.setFadeRate(uiFadeAmount.as<int>());
59 particles.setLifetime(uiLifetime.as<float>() * 1000);
60 particles.setOverdrawCount(uiOverdrawCount.as<int>());
61 particles.setCyclical(uiCyclical.value());
62
63 // Manual spawn
64 if (uiSpawnButton.clicked()) {
65 particles.spawnRandomParticle();
66 }
67
68 // Auto spawn (external control)
69 if (uiAutoSpawn.value() && now - lastSpawnTime >= uiSpawnInterval.as<float>() * 1000) {
70 particles.spawnRandomParticle();
71 lastSpawnTime = now;
72 }
73
74 // Draw particles
75 particles.draw(fl::Fx::DrawContext(now, leds));
76
77 FastLED.show();
78 delay(20);
79}

Callers

nothing calls this directly

Calls 14

DrawContextClass · 0.85
setFadeRateMethod · 0.80
setLifetimeMethod · 0.80
setOverdrawCountMethod · 0.80
setCyclicalMethod · 0.80
spawnRandomParticleMethod · 0.80
millisFunction · 0.50
delayFunction · 0.50
setBrightnessMethod · 0.45
setSpeedMethod · 0.45
valueMethod · 0.45
clickedMethod · 0.45

Tested by

no test coverage detected