I feel like this is a fundamental code question.
I want to use a hotpot (100-10Kohm), a pressure sensitive potentiometer, like those sold by sparkfun for an LED project. But unlike a regular pot, once you take your finger off the hotpot it's resistance goes back to the minimum 100ohm. You can put your finger on one spot and get a specific resistance or slide your finger along and change the resistance.
The fundamental question is this: one would use analog read to read the value of a regular pot and then store that value to an int.
But with a hotpot I need the arduino to constantly monitor the hotpot(three of them in fact) and detect when the hotpot is being actuated. Moreover, I need the arduino to measure in "realtime" if someone is sliding their finger along the hotpot and update the stored value at some reasonable rate (5Hz) and finally detect the last resistance measurement when the person removes their finger.
I have almost no idea how to do this and would appreciate any help, even if it is to say this can only be done with interrupts and direct c coding.
What I'v tried so far is a an awkward series of if, else statements. In the main loop I have analog read check the pot and divide by 10 to get values from 0-1024, if it is greater than 5 (allow for some jitter) write the value to int hotPotnew, else move on to the next hotpot. Next I compare the hotPotnew to hotPotcurrent to see if it is greater, lesser, or equal. I've not been able to make this part functional since putting your finger in the middle of the hotpot will get you about 5Kohms +/- 250ohms. How does one compare two values while allowing for some variability/error? But even if I could get that to work, I need some way to structure the program so that if someone is moving their finger along the hotpot the arduino will constantly poll it and record. But if someone isn't touching the hotpot or not moving, it will go on and read hotPot2 and hotPot3.
Is this hopelessly complex for a noob? and examples would be much appreciated.