Tracking time between the ON and OFF, then another ON and OFF, the program should be able to tell if a double tap occured.
Does anyone have experience with a program like this, any catches I should be worried about? Especially if I try to ad a triple tap :cool:
Yeah, some. Nothing is really cast in stone.
Too many things that can differ from one device to the next.
Just mess around with it some.
Try different delays values.
Try to "bracket" the delay a few times (short one, long one, less short one, less long one...)
That should zero in a few minutes.
Too long delays make the system feel sluggish, unresponsive.
Too short, and the program responds to the bounces (as you noticed).
I would think that once you get it working on one click, all the rest should work right.
Remember, we are talking about machine speed here.
The people part pressing the button should never notice this delay.
It's for the machine part...
As for the double and triple tap, I've not done those.
Iwould think the trick is to catch the CNT after the first click and then
decide if the next click is within the time limit you think proper for a
double. Then again for a triple?
I think you should simply experiment a little bit. First try to find the best time to wait to eliminate the bouncing. It should be as little as possible. Then you can try to measure the time between two button pushs in case of a double/triple click.
This would be the algorithm:
wait for push
wait for release
wait for push for max. measured time between double/triple pushs
if time exceeded it was a single click and go back to top
wait for release
wait for push for max. measured time between triple pushs
if time exceeded it was a double click and go back to top
else it was a triple click
wait for release
go back to top
A few hours ago I found some other threads about debounce (simply search for debounce). There was one thread where Jonny Mac gave a "debounce" function which includes a maximum waittime. Maybe I'll find it again.
Comments
Yeah, some. Nothing is really cast in stone.
Too many things that can differ from one device to the next.
Just mess around with it some.
Try different delays values.
Try to "bracket" the delay a few times (short one, long one, less short one, less long one...)
That should zero in a few minutes.
Too long delays make the system feel sluggish, unresponsive.
Too short, and the program responds to the bounces (as you noticed).
I would think that once you get it working on one click, all the rest should work right.
Remember, we are talking about machine speed here.
The people part pressing the button should never notice this delay.
It's for the machine part...
As for the double and triple tap, I've not done those.
Iwould think the trick is to catch the CNT after the first click and then
decide if the next click is within the time limit you think proper for a
double. Then again for a triple?
Let's see what you come up with?
This would be the algorithm:
wait for push
wait for release
wait for push for max. measured time between double/triple pushs
if time exceeded it was a single click and go back to top
wait for release
wait for push for max. measured time between triple pushs
if time exceeded it was a double click and go back to top
else it was a triple click
wait for release
go back to top
A few hours ago I found some other threads about debounce (simply search for debounce). There was one thread where Jonny Mac gave a "debounce" function which includes a maximum waittime. Maybe I'll find it again.