Pages: [1]   Go Down
Author Topic: how to set a timeout for button press..??  (Read 371 times)
0 Members and 1 Guest are viewing this topic.
INDIA
Offline Offline
Sr. Member
****
Karma: 0
Posts: 382
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am using buttons in one of my project..
I would like to set a timeout..

for example if i press one button the program enters a menu or settings mode..then user does a job..

but if no buttons are pressed within a certain time it the LCD will go back to its home screen.


Please give me an idea how to set the timeout of the button press...??

some code will be much better smiley-wink
« Last Edit: March 04, 2012, 07:36:16 am by Joy » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 642
Posts: 50365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am using buttons in one of my project..
Does that involve clothing? If it's an electronic project, switches would be more appropriate.

Quote
Please give me an idea how to set the timeout of the button press...??
You can't.

What you need to do is record when the "display the menu" switch was pressed. Record when any subsequent "interact with the menu" switches are pressed.

Periodically, see if now (millis()) minus then exceeds some value. If so, change what the Arduino is doing (take the menu down).
Logged

Pages: [1]   Go Up
Jump to: