Dlloydev / QuickPID

A fast PID controller with multiple options. Various Integral anti-windup, Proportional, Derivative and timer control modes.
MIT License
195 stars 50 forks source link

Error on relay output example #25

Closed MtStable closed 3 years ago

MtStable commented 3 years ago

I believe there is an error on the PID_RelayOutput example code line 64. Second condition should be Output > (millis() - windowStartTime). Otherwise the on and off periods of the cycle switch places and as the input approaches the output the duty cycle increases.

Original line is as below: if (((unsigned int)Output > minWindow) && ((unsigned int)Output < (millis() - windowStartTime))) digitalWrite(RELAY_PIN, HIGH);

Dlloydev commented 3 years ago

Yes, I agree. Thanks for pointing this out. On the next update, I'll change line 64 to: if (((unsigned int)Output > minWindow) && ((unsigned int)Output > (millis() - windowStartTime))) digitalWrite(RELAY_PIN, HIGH);

Dlloydev commented 3 years ago

Completed (Version 2.4.7)