Hello,
I have a problem with setting hour and minutes. I can set newhour and newmin values but they are not stored and I can not change time. Could you please let me know what I'm doing wrong? Below is fragment of the code. All state, newhour, newmin, change etc are declared correctly.
Thanks in advance
Greg
if (digitalRead(settings) == LOW) {delay(30); if(digitalRead(settings) == LOW); state = state + 1;
newhour = dt.hour; newmin = dt.minute;
if (state >= 4) {state == 0;}}
if (state == 1) {
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_crox3hb_tf);
u8g2.setCursor(80, 20);
u8g2.print("NEW TIME");
u8g2.setCursor(40, 40);
u8g2.print("HOUR: ");
if (digitalRead(change) == LOW) {delay(30); if(digitalRead(change) == LOW);
newhour = newhour + 1;
if (newhour >23) {newhour = 0;}}
u8g2.print(newhour);
} while ( u8g2.nextPage() );
}
if (state == 2) {
u8g2.firstPage();
do {
u8g2.setCursor(80, 20);
u8g2.print("NEW TIME");
u8g2.setCursor(40, 40);
u8g2.print("MINUTES: ");
if (digitalRead(change) == LOW) {delay(30); if(digitalRead(change) == LOW);
newmin = newmin + 1;
if (newmin >59) {newmin = 0;}}
u8g2.print(newmin);
} while ( u8g2.nextPage() );
}
if (state == 3) {
clock.setDateTime(dt.year, dt.month, dt.day, newhour, newmin, 0);
state = 0;}