Re: Capacitive touch - trapping a long press?
I was thinking of some logic outside the interrrupt routine, in the main program. In the interrupt routine you find the variables Last_High_Reading and Current_Reading. Even though the main program is stuck in a loop, it will still be going to the interrupt routine. I was thinking of something like this,
Cnt = 0
REPEAT
'Main program will be in this loop until sensor is released.
Cnt = Cnt + 1
Pause 2
If Cnt > 500 then RETURN
'A long press was detected. Exit sub-routine.
UNTIL Current_Reading > 0.8*Last_High_Reading
"No one is completely worthless. They can always serve as a bad example."
Anonymous
Bookmarks