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: mbed
Fork of Robotics_Lab_Servo by
Diff: main.cpp
- Revision:
- 6:52f6c4d57d74
- Parent:
- 5:d495dc55f709
- Child:
- 7:db4ddfc0cf4e
diff -r d495dc55f709 -r 52f6c4d57d74 main.cpp
--- a/main.cpp Thu Mar 10 07:09:09 2016 +0000
+++ b/main.cpp Thu Mar 10 07:26:03 2016 +0000
@@ -61,8 +61,8 @@
//////code for PI control//////
err = angle_ref - angle_read;
- ierr = 0.01f - 0.01f*err;
- PI_out = Kp * err + Ki * ierr;
+ ierr += err;
+ PI_out = Kp * err + Ki * 0.01f*(ierr - err);
////////////
if(PI_out >= 0.5f)PI_out = 0.5;
