No.9 Robotics / Mbed 2 deprecated Robotics_Servo_control

Dependencies:   mbed

Fork of Robotics_Lab_Servo by LDSC_Robotics

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;