Hi, i'm sure many of you will know of the CapSense library that can be used on the arduino where a large metal pad, along with a suitably large resistor can be used to create a capacitive proximity sensor. Now this is all well and good apart from the fact that the code is blocking! It works by setting the "charge" pin high and counting the time until the "sense" pin goes high, this time will be somewhat inversely proportional to distance. The problem here obviously is that the code waits UNTIL the pin goes high. What i'd like to do is use one of the timers on the maple with suitably set prescaler and overflow and start it counting once the "charge" pin is set high. Once the "sense" pin is high, i'd like the timer to stop, the current timer value to be stored in a variable and the timer reset to zero.
If the timer reaches the overflow, i'd also like it to stop too, therefore "limiting" the maximum value that the sensor can achieve. What would be the best way to do this and how can I attach external interrupts to pins (is there an example sketch...)?
Any help appreciated as per!
Harris