Hi there. I don’t have any code yet; because, for now, I don’t have anything for testing it.
Okay let’s get into the subject’s point. I’m going to program some animations for a RGB LED strip (not the one that I can control each LED individually); and as you may know, the
delay statements are perfect for making LEDs fade-in and out.
My idea is to have a “counter” variable that chooses the animation to execute over and over (until the button is pressed again). Then, each animation gets enclosed in a “case” of a
But the next thing is my question: how to make my program detect the button even when it’s “trapped” in a
for statement execution? The effect that I expect is when I push the button while fading-in or out, change the animation immediately.
I hope you understood me and I will appreciate your answers.
PD: another question: how to implement a “debounce” algorithm into my sketch? Because I read somewhere that mechanical switches “bounces” for a very small fraction of a second when pressed, but long enough to lead into microcontroller misreadings.