Remco Dasselaar / Mbed 2 deprecated TotalControlEmg2

Dependencies:   HIDScope MODSERIAL QEI TextLCD mbed

Fork of TotalControlEmg2 by Remco Dasselaar

Revision:
32:40691708c68c
Parent:
31:074b9d03d816
Child:
33:b4757132437e
diff -r 074b9d03d816 -r 40691708c68c main.cpp
--- a/main.cpp	Mon Oct 19 10:30:32 2015 +0000
+++ b/main.cpp	Mon Oct 19 11:24:44 2015 +0000
@@ -225,10 +225,22 @@
                 }
             case KALIBRATE_AIM: {
                 pwmM2.period(1/100000);            // aanstuurperiode motor 2
-                PRINT("Kalibrate aim motor\r\n");
+                PRINT("Position is kalibrating\r\n");
                 wait(1);
-                pc.printf("Use L and R to move pendulum to equilibruim position\r\n L+R = OK\r\n");                                
-                while(state==KALIBRATE_AIM){ 
+                //pc.printf("Use L and R to move pendulum to equilibruim position\r\n L+R = OK\r\n");                                
+                while(state==KALIBRATE_AIM){
+                    dirM2.write(0);              // richting
+                    pwmM2.write(0.25);             // width aanpassen
+                    
+                    if(KS.read() > 0.5){
+                        pwmM2.write(0);             // motor stilzetten
+                        enc2.reset();               // resetknop = encoder 1 resetten
+                        PRINT("Position kalibrated\r\n");
+                        state = KALIBRATE_PEND;         // volgende state
+                        }
+                        
+                    
+                    /* 
                     if(regelaarFlag){       // motor regelen op GoFlag
                         regelaarFlag = false;                  
                         checkAim();         // Controleer positie                       
@@ -240,7 +252,7 @@
                             pc.printf("Positie gekalibreerd, kalibreer nu slinger, encoder counts: %i\r\n", enc2.getPulses());
                             state = KALIBRATE_PEND;         // volgende state                        
                             }
-                        }
+                        }*/
                     }
                 break;
                 }