As used for motor testing May / June 2016

Dependencies:   iC_MU mbed-rtos mbed

Fork of SweptSine by Vitec Group

Revision:
2:be3b6a72f823
Parent:
1:0f0423207b62
Child:
3:463edcfc09c5
--- a/main.cpp	Tue Mar 22 10:57:41 2016 +0000
+++ b/main.cpp	Tue Mar 22 15:35:01 2016 +0000
@@ -5,13 +5,15 @@
 
 // iC-MU Encoder Objects
 iC_MU icMu(p5,p6,p7,p8);
+iC_MU icMu_Output(p5,p6,p7,p11);
 
 // Pan Motor
 PwmOut Pan_Motor_PWM(p21);                      // Purple wire
 DigitalOut Pan_Motor_Direction(p22);            // Yellow wire
 
 /* Kp = 0.00018, Ki = 0.000006, Kd = 0.0, 0.0001 */
-Classic_PID PanVelocityPID(0.00018, 0.000006, 0.0, 0.0001);     //Kp, ki, kd, kvelff
+//Classic_PID PanVelocityPID(0.00018, 0.000006, 0.0, 0.0);     //Kp, ki, kd, kvelff
+Classic_PID PanVelocityPID(0.000006, 0.0000001, 0.0, 0.0);     //Kp, ki, kd, kvelff
 
 // Serial objects
 Serial pc (USBTX,USBRX);
@@ -44,8 +46,10 @@
 
     // Initalise Pan PID Loop
     PanVelocityPID.setProcessLimits(1.0, -1.0);
-    PanVelocityPID.setSetPoint(0);
-    LasticMuPosition = icMu.ReadPOSITION() >> 1;
+    PanVelocityPID.setSetPoint(262144);    // Set the motor to 2^18
+    //PanVelocityPID.setSetPoint(0);
+    //LasticMuPosition = icMu.ReadPOSITION() >> 1;
+    
 
     // Increase terminal speed
     pc.baud(921600);