"if (msNow > nextSwitchTime) { nextSwitchTime = msNow + debounce;"
is used in the PID_RelayOutput example,
When nextSwitchTime overflows, the comparison results for the next cycle will be wrong.
//should use
if(millis() - lastMillis >= interval){
//and NOT like
if(millis() >= lastMillis + interval){
"if (msNow > nextSwitchTime) { nextSwitchTime = msNow + debounce;"
is used in the PID_RelayOutput example,
When nextSwitchTime overflows, the comparison results for the next cycle will be wrong.
//should use
if(millis() - lastMillis >= interval){
//and NOT like
if(millis() >= lastMillis + interval){