I need to measure the total number of seconds a button is pressed. More specifically, I need to count the number of seconds first press, second press, third press, etc, and add the total number of seconds that the switch has been activated.
Could anyone point me in the direction? Any resources you might recomend are greatly appriciated.
Basically, you can use millis() to keep track of time. You can then store them as variables, such as initial for the first press, then another for duration, etc. There are several example sketches and libraries on the Arduino website that make using buttons much simpler.
Basically, you can use millis() to keep track of time. You can then store them as variables, such as initial for the first press, then another for duration, etc. There are several example sketches and libraries on the Arduino website that make using buttons much simpler.
No problem. When I first used butons, I originally did all the coding myself. Once I found out about the libraries out there, I realized its not only faster, but also much simpler and more efficient to use hardware abstraction libraries!