Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HIDScope MODSERIAL QEI TextLCD mbed
Diff: main.cpp
- Revision:
- 32:40691708c68c
- Parent:
- 31:074b9d03d816
- Child:
- 33:b4757132437e
--- 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;
                 }