Non blocking capacitive sensor

Hey guys,

I'm wondering of a way that I can write a piece of non blocking capacitive sensor code.

Of my current understanding:

You place the resistor between the digital output and capacitive pad high, then wait until the pin connected on the other side of the resistor goes high. Would the only way to do this be to use an interrupt when it eventually does go high, or keep polling?

Cheers,

I would use a voltage comparator and a interrupt. You can then set the trigger point voltage. The interrupt will execute when the comparator transitions.