I try to solve the following topic:
I want that the integer Minute goes up by 1 if I press an external button, while the whole project is running. So for example the integer contains the value 31 (Minute = 31), I want to be able to press the button and the integer should go up by 1, so now it contains the value 32 (Minute = 32). Because the action should trigger at 11:32. I want that it works without restarting everything.
void loop() {
int Minute = 31;
DateTime now = rtc.now();
if (now.hour() > 11 || (now.hour() == 11 && now.minute() == Minute)) {
//action ......
}
I hope you can understand my question, I already tried it with a simple if clause, but it seems that the integer does not goes up or the code does not update:
void loop(){
int Minute = 31;
if (buttonState == HIGH){
Minute = Minute + 1;
}
DateTime now = rtc.now();
if (now.hour() > 11 || (now.hour() == 11 && now.minute() == Minute)) {
//action...
}
}
PS: Of course i declared everything in the void setup etc.