8000 Update PID_v1.cpp · br3ttb/Arduino-PID-Library@ef7438e · GitHub
[go: up one dir, main page]

Skip to content

Commit ef7438e

Browse files
authored
Update PID_v1.cpp
1 parent 9b4ca0e commit ef7438e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

PID_v1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ bool PID::Compute()
6565
/*Compute all the working error variables*/
6666
double input = *myInput;
6767
double error = *mySetpoint - input;
68-
double dInput = (input - lastInput);
69-
outputSum+= (ki * error);
68+
double dInput = Sampletime*(input - lastInput)/timechange;
69+
outputSum+= timechange*(ki * error)/Sampletime;
7070

7171
/*Add Proportional on Measurement, if P_ON_M is specified*/
7272
if(!pOnE) outputSum-= kp * dInput;

0 commit comments

Comments
 (0)
0