HELP with Menu controlled with buttons


hey!

i'm trying make clock using arduino, rtc (bus i2c) , led display (2x16).

i have 3 buttons (switches) , want make menu navigate different options, are:

- set date/time
- set alarm

pseudocode this:

code: [select]

void loop(){
showtimedate(); //function shows time , date rtc
if(buttonmenuispressed){
lcd.print("-> set date/time"); //prints in first line of lcd
lcd.print("set alarm"); //prints in second line ( know how lcd lib, skip here since it's not trouble is).

if(buttonmenuispressed){ //enter selected submenu (set date/time)
setdatetime(); //call function set it
}
else if(buttonbackispressed){
->> go start of void loop (how? break?)
}
else if(buttondownispressed){
lcd.print("set date/time");
lcd.print("->set alarm");
if(buttonbackispressed){
->> go start of void loop (how? break?)
}
else if(buttonmenuispressed){
setalarm();
}




that's have far; guess have trouble debouncing buttons (the third button navigate , down through hours). have read , trying debounce thing, think it's not working don't know if there's working lib me in case.

also guess better if used while's or switch function since put many nested if's.. i'm blocked , dunno how actually...

any more welcome!!






quote
i guess have trouble debouncing buttons
why? need post of code, , wiring diagram, in order know whether wiring switches correctly and/or reading them correctly.


Arduino Forum > Using Arduino > Programming Questions > HELP with Menu controlled with buttons


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code