Hi guys,
I´m having trouble with a thing a want to make.
I´m making a clock, and it has two buttons (one is set and the other is on/off).
I wana that when someone push (and keep pushing it) the buton on/off and later the set buttons it chages the hour, and when someone push the set button (and keep pushing it) and later the on/off it changes the minutes.
if (on_off==1){
if(set==1){
adjustTime(3600);
}
}
else if (set==1){
if(on_off==1){
adjustTime(60);
}
}
In the first part you test on_off and then test set
In the second part you have it the other way round.
I doubt very much if that is logical, even if the compiler does not care.
Also else if (set ==1) is not the logical opposite of if (on_off == 1)
Logically they have nothing to do with each other.
In fact what your ELSE clause is doing is
if (on_off != 1 && set == 1)