Go Down

Topic: how to set a timeout for button press..?? (Read 386 times) previous topic - next topic

Joy

Mar 04, 2012, 01:33 pm Last Edit: Mar 04, 2012, 01:36 pm by Joy Reason: 1
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 ;)

PaulS

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).

Go Up