Hello,
I noticed that the sum of the value in the windowStartTime variable occurs, but it seems to me that it is not restarted, so in a moment it seems to overflow.
PID_RelayOutput.ino:
if (millis() - windowStartTime > WindowSize)
{ //time to shift the Relay Window
windowStartTime += WindowSize;
}
Based on the Blink code, the variable can be set using the value of millis(), this way it must always have a value within the operating range:
if (millis() - windowStartTime > WindowSize)
{ //time to shift the Relay Window
windowStartTime = millis();
}
Ref.:
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
[...]
}
https://docs.arduino.cc/built-in-examples/digital/BlinkWithoutDelay
Hello,
I noticed that the sum of the value in the windowStartTime variable occurs, but it seems to me that it is not restarted, so in a moment it seems to overflow.
PID_RelayOutput.ino:
Based on the Blink code, the variable can be set using the value of millis(), this way it must always have a value within the operating range:
Ref.:
https://docs.arduino.cc/built-in-examples/digital/BlinkWithoutDelay