Main Site Documentation

Button module - querying time it is held down for


#1

Is there any ‘easy’ way to query how long the button is held down for? (thereby giving two or more uses to it)

i realize the ‘hard’ way would be to grab the time at the moment of initial depress, and then check the time after the depress event fires off; was just wondering if there’s an easier way. No biggie if not…just means a little more coding involved.

Thanks!


#2

@ verbosewater - There is no non-blocking way of capturing the pressed time of a button. There is a SignalCapture class in the premium library, which can do this, but it is blocking.

It just takes a few lines of code to achieve.