-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
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.
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
Metadata
Metadata
Assignees
Labels
No labels