control for robotic arm that can play chess using a granular gripper

Dependencies:   Encoder mbed HIDScope Servo MODSERIAL

Fork of chessRobot by a steenbeek

Revision:
126:56866cefaa08
Parent:
125:749b8ce2e040
Child:
127:831f03471efb
--- a/main.cpp	Thu Oct 29 17:41:10 2015 +0000
+++ b/main.cpp	Thu Oct 29 20:06:41 2015 +0000
@@ -31,7 +31,7 @@
     debugTick.attach(&debug_activate, motorCall);
     motorTick.attach(&motor_activate, motorCall);
     safetyTick.attach(&safety_activate, 0.001f);
-    serialTick.attach(&serial_activate, 0.05f);
+    
 }
 
 double motorCall = 0.01; // set motor frequency global so it can be used for speed.
@@ -47,10 +47,21 @@
 
 
 int main(){
+    serialInit();
+    serialTick.attach(&serial_activate, 0.1f); // initialze serial communication first
     motorInit();
-    calReady = true; // calibrateMotors();
+
+
+
 
     while (true) {
+        
+        calReady = calibrateMotors();
+        
+        if(serial_go){
+            serial_go=false;
+            serialCom();
+        }
 
         if(calReady && !tickersActivated){ // when done with calibration, start tickers
             tickerAttach();
@@ -82,10 +93,7 @@
                 motor_go=false;
                 motorControl();
             }
-            if(serial_go){
-                serial_go=false;
-                serialCom();
-            }
+
         }
     }
 }
\ No newline at end of file