Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Nucleo_blink_led mbed
Fork of Nucleo_blink_led by
Diff: calculateFunc.cpp
- Revision:
- 6:a652deaae134
- Parent:
- 5:dfea493f7a12
- Child:
- 7:11dd5581c763
--- a/calculateFunc.cpp Sun Mar 11 13:15:34 2018 +0000 +++ b/calculateFunc.cpp Sun Apr 01 18:21:50 2018 +0000 @@ -5,16 +5,14 @@ { //USE ERROR TO CALCULATE PID VALUES Prop = errorVar; - //Inte = Inte + errorVar; - //Dere = ((errorVar - previousError); - - //THIS IS CALLED HERE BECAUSE WE NEED TO USE PREVIOUS ERROR BEFORE IT'S OVERWRITTEN - //errorAccumulate(); + Inte = Inte + errorVar; + Dere = ((errorVar) - (previousError)); //BECAUSE THE CURRENT ERROR IS CALCULATED IN A FUNCTION BEFORE THIS, ON THE NEXT ITERATION WE WANT TO REMEMBER THE PREVIOUS VARIABLE previousError=errorVar; //FORMULATE OFFSET VALUE FROM ERROR, PID VALUES AND CONSTANTS - PIDs = (Kp*Prop);// + (Ki*Inte) + (Kd*Dere); + PIDs = (Kp*Prop)+(Kd*Dere)+(Ki*Inte); + newPIDs=PIDs; return; } \ No newline at end of file