1

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 (http://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 Apr 03 '15 at 18:24

1 Answers1

2

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.

Vassilis
  • 36
  • 2