Aukie Hooglugt / Mbed 2 deprecated BMT-M9_motorcontrol

Dependencies:   Encoder HIDScope MODSERIAL mbed-dsp mbed

Fork of BMT-M9_motorcontrol_groep3 by Aukie Hooglugt

Files at this revision

API Documentation at this revision

Comitter:
vsluiter
Date:
Tue Oct 08 14:55:40 2013 +0000
Parent:
1:5ac85aad9da4
Child:
3:1e8e76b775b7
Commit message:
Added averageing of potmeter;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Sep 26 13:08:21 2013 +0000
+++ b/main.cpp	Tue Oct 08 14:55:40 2013 +0000
@@ -60,8 +60,8 @@
         while(!looptimerflag);
         looptimerflag = false;
         setpoint = (getpotAverage())*2000;
-        new_pwm = (setpoint - motor1.getPosition())*.001;
-        //new_pwm = pid(setpoint, motor1.getPosition());
+        //new_pwm = (setpoint - motor1.getPosition())*.001;
+        new_pwm = pid(setpoint, motor1.getPosition());
         coerce(&new_pwm, -1,1);
         if(new_pwm > 0)
             motordir = 1;