int lastTime;
if ((millis() - lastTime) > 5000) {
Serial.Println("Timer!");
lastTime = millis();
}
For some reason the timer waits only once for the 5000 ms. After the first time, the function inside the if condition is executed with every program cycle.
I don't know what I'm doing wrong?
Please follow the advice given in the link below when posting code , use code tags and post the code here to make it easier to read and copy for examination