diff --git a/PID_v1.cpp b/PID_v1.cpp index cb6637c..2d6a922 100644 --- a/PID_v1.cpp +++ b/PID_v1.cpp @@ -65,8 +65,8 @@ bool PID::Compute() /*Compute all the working error variables*/ double input = *myInput; double error = *mySetpoint - input; - double dInput = (input - lastInput); - outputSum+= (ki * error); + double dInput = 1000*(input - lastInput)/timechange; + outputSum+= 1000*(ki * error)/timechange; /*Add Proportional on Measurement, if P_ON_M is specified*/ if(!pOnE) outputSum-= kp * dInput;