This commit is contained in:
LaurentDelaon 2019-07-31 08:34:09 +00:00 committed by GitHub
commit 99ec435bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,6 +62,8 @@ bool PID::Compute()
unsigned long timeChange = (now - lastTime);
if(timeChange>=SampleTime)
{
// take the start sample time
lastTime = now;
/*Compute all the working error variables*/
double input = *myInput;
double error = *mySetpoint - input;
@ -88,7 +90,7 @@ bool PID::Compute()
/*Remember some variables for next time*/
lastInput = input;
lastTime = now;
return true;
}
else return false;