Go Down

Topic: 2 pushbuttons and menu select (Read 702 times) previous topic - next topic

shanevedder

for a project i must have 2 push buttons and from this i must execute the following

menu 1         zone1
                        zone2
                       zone3

menu 2         duration 1
                        duration 2

menu3        time 1
                      time 2
                      time 3

menu 4      you have chosen zone 3,duration 2. time 3


when you hit first button it should toggle through each menu, when you push button 2 it should change incremenent time,duration and zone according to the menu selection. need help with the code!!!

A.R.Ty

WHERE should the menu be displayed on / at ?
Dum spiro, spero - if you find my posting helpful, please click my Karma :)<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />Do you know A.R.T, the FREE Android Root Tool ?

shanevedder

should be displayed under the serial monitor
but i cant seem to figure it out

waski

I would try using one button to move across menus, second button to move across options and long press of the second button as an "enter" button while long press of the First button could act as an "escape".  You have to count How many times button was pressed and use switch case. Then in each case you will have switch cases for options. For debouncing buttons and detecting long pressed you can use one of the button libraries. I'll try to write some code when i get back home but you can search for switch case menu egzamples.

A.R.Ty

as Pane waski  ;) already wrote: you have only 2 choices with 2 buttons):
that one that waski wrote or, instead, you can press both buttons for "enter" - but a little bit tricky with timing  :smiley-mr-green:
Dum spiro, spero - if you find my posting helpful, please click my Karma :)<br />~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />Do you know A.R.T, the FREE Android Root Tool ?

Go Up