Ramon Waninge / Mbed 2 deprecated Milestone1

Dependencies:   FastPWM mbed QEI biquadFilter HIDScope MODSERIAL

Revision:
38:681100ce5fb8
Parent:
36:077fe5b3189b
diff -r 077fe5b3189b -r 681100ce5fb8 main.cpp
--- a/main.cpp	Wed Oct 31 10:24:01 2018 +0000
+++ b/main.cpp	Wed Oct 31 11:14:36 2018 +0000
@@ -35,7 +35,7 @@
 // Utilisation of libraries
 MODSERIAL   pc(USBTX, USBRX);
 QEI         Encoderl(D9,D8,NC,4200);        // Counterclockwise motor rotation is the positive direction
-QEI         Encoderr(D11,D10,NC,4200);      // Counterclockwise motor rotation is the positive direction
+QEI         Encoderr(D10,D11,NC,4200);      // Counterclockwise motor rotation is the positive direction
 QEI         Encoderf(D13,D12,NC,4200);      // Counterclockwise motor rotation is the positive direction
 Ticker      motor;
 Ticker      encoders;
@@ -130,17 +130,17 @@
             return  angle;
         }
         
-float*    turnl()    // main function for movement of motor 1, all above functions with an extra tab are called
+float*    turnr()    // main function for movement of motor 1, all above functions with an extra tab are called
 {   
     //float   refvalue = pi/4.0f;
     float   refvalue = DesiredAnglel();                             // different minus sign per motor
-    int     counts = Countslinput();                               // different encoder pins per motor
+    int     counts = Countsrinput();                               // different encoder pins per motor
     float   currentangle = CurrentAngle(counts);                  // different minus sign per motor
     float   PIDcontrol = PIDcontroller(refvalue,currentangle);   // same for every motor
     float   error = ErrorCalc(refvalue,currentangle);            // same for every motor
     
-    pin6 = fabs(PIDcontrol);                                       // different pins for every motor
-    pin7 = PIDcontrol > 0.0f;                                      // different pins for every motor
+    pin5 = fabs(PIDcontrol);                                       // different pins for every motor
+    pin4 = PIDcontrol > 0.0f;                                      // different pins for every motor
     //pin6 = 0.4+0.6*fabs(PIDcontr);     //geschaald
     //pin6 = fabs(PIDcontr)/pi;
     //pc.printf("     error:  %f      ref: %f     angle:  %f \r\n",error,refvalue,currentangle);
@@ -171,7 +171,7 @@
             
     while   (true)
     {   
-        float* motoroutcomel = turnl();
+        float* motoroutcomel = turnr();
         float motorl1 = motoroutcomel[0];
         float motorl2 = motoroutcomel[1];
         float motorl3 = motoroutcomel[2];