I'm having a soft pot meter here and I would like to register the duration of the touch event. I'm having a different variable, which keeps going from 1024 to 0 , which regularly takes 60 seconds, but for every second you touch the soft pot meter the count adds 50 up to 1024. Like returning the clock backward.

How would I register/code this?

Softpot meter

  • You'll probably want to use millis (arduino.cc/en/reference/millis) to see how long the user touches the sensor.. that's a starting point. Post some code you've tried and we can help you figure it out.
    – sachleen
    Commented Apr 3, 2015 at 18:24

1 Answer 1


You have to go with timer interrupts. Here is the documentation: http://playground.arduino.cc/code/timer1

Roughly, when you detect a press, an interrupt is raised and the same thing goes for releasing. Using the timer values from both these events, you can accurately measure the time that the press lasted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.