PD Control for KL05Z

Dependencies:   QEI mbed

Revision:
1:8ff6c7474d95
Parent:
0:259b726d0807
Child:
2:f84a70291ac8
--- a/main.cpp	Sun Sep 01 19:45:48 2013 +0000
+++ b/main.cpp	Sun Sep 01 19:50:00 2013 +0000
@@ -33,7 +33,7 @@
     position = pulsesToRadians(encoder.getPulses());        //use the getPulses functin to read encoder position, convert value to radians
     old_error = error;                                      
     error = position - desired_position;
-    command = KP*error + KD*sample_period*(error-old_error);    //modify the command
+    command = KP*error + KD*sample_period*(error-old_error);    //modify the command based on position feedback
     
     
 }