Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion PID_v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -88,7 +90,7 @@ bool PID::Compute()

/*Remember some variables for next time*/
lastInput = input;
lastTime = now;

return true;
}
else return false;
Expand Down