Button Delay, Reset type functionality
DShannon
Posts: 26
Hi all,
A question that i'm sure someone can help with.
With 1 button input to the stamp, I need to perform 2 functions, based on the following rule:
1) If button is held down for 3 seconds, function "X" is performed
2) else, function "Y" is performed if button is pushed for only 100 ms
This would be like a digital clock in a car - If I hold down the button, I enter clock setting mode. however, If i momentarily press the same button, the clock changes modes (ie, shows the calendar date)
I have racked my brain and tried different IF THEN logic, but cant seem to get it, even a "hack"!
Any ideas????
Thanks!
-Dan
A question that i'm sure someone can help with.
With 1 button input to the stamp, I need to perform 2 functions, based on the following rule:
1) If button is held down for 3 seconds, function "X" is performed
2) else, function "Y" is performed if button is pushed for only 100 ms
This would be like a digital clock in a car - If I hold down the button, I enter clock setting mode. however, If i momentarily press the same button, the clock changes modes (ie, shows the calendar date)
I have racked my brain and tried different IF THEN logic, but cant seem to get it, even a "hack"!
Any ideas????
Thanks!
-Dan
Comments
1) Wait until button is pressed
2) Set a variable to 0 ("Timer" for example)
3) Wait until button is released, incrementing Timer each time through
4) If Timer > 3 seconds Then "X"
5) Else if Timer < 100ms Then "Y"
6) GOTO 1)
Post Edited (TimTech) : 3/4/2005 3:03:32 AM GMT
Something like this:
ticks VAR Byte
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com