button timer on delay.

hello I know how to use the on delay and make button deboance and all.

now what i want to know is how can i program the arduino to be able to set a timer on as long as the button is press, if after a duration the button is press some action will be done, however if the button is release b4 the timer run out, the timer is reset to 0

now what i want to know is how can i program the arduino to be able to set a timer on as long as the button is press, if after a duration the button is press some action will be done, however if the button is release b4 the timer run out, the timer is reset to 0

Timers are not abundant on the Arduino. Time, on the other hand, is readily available (relative time, anyway). So, if you are properly detecting the transitions (pressed to released and released to pressed), you can record when the transition occurred, using millis(). When the transition to released occurs, you can determine if the time between to-pressed and to-released was long enough.

you know what PaulS, i been banging my head up a wall for week trying to get some idea how to implement this, Your simple but full with knowledge have gave me a lot of idea and yeah thank you so much PaulS.