Hello,
I have made a very simple timer program as there was something going wrong on one of my projects.
All it does is print to the serial "3 seconds" every 3 seconds, which it does for the first 15 seconds or so. Then it suddenly starts printing it all the time just basically every loop.
Is there something I am missing here? Any help would be appreciated, Thanks
int timer = 0;
void setup(void){
Serial.begin(115200);
}
void loop(void){
if((millis() - timer) >= 3000)
{
Serial.println("3 seconds");
timer = millis();
}
}