Hello
I’m developing an operation that does led control with a button, I use a counter for this, but every time I hold the button, the counter increases further than 1 So indeed if I hold the button down, I want it to increase once.
Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people's questions & connect with other people.
Volt.Tech
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Perhaps you should debounce the button, as mechanical buttons bounce, i.e. may produce more than one pulse per button press. There are several techniques to do that, one of the easiest is to connect some small capacitor in parallel to the button, which together with the pull resistor forms some lowRead more
Perhaps you should debounce the button, as mechanical buttons bounce, i.e. may produce more than one pulse per button press.
There are several techniques to do that, one of the easiest is to connect some small capacitor in parallel to the button, which together with the pull resistor forms some low pass filter. The time constant of that filter should be slightly lower than the period of the maximum speed to press that button(e.g.100.200 ms). You’ll find this solution also at the NUCLEO or DISCOVERY boards.
See less