Hi! I'm a newbie in using Arduino (and also in programming actually).
So I've tried some of the built-in experiments and came across the tact switch, I just got curious, how do you program a tact switch so that the LED will remain lit up even when you don't press it anymore? And once you do the LED will turn off.
Answers and explanations are greatly appreciated. Thanks!
Test for when the switch becomes pressed. Toggle the LED. Wait 10 milliseconds to debounce the switch. Test for when the switch becomes released. Repeat.
Knowing how it has changed requires that you keep the last switch state in a variable.