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:
124:f67ce69557db
Parent:
117:b1667291748d
Child:
125:749b8ce2e040
--- a/main.cpp	Wed Oct 28 13:38:36 2015 +0100
+++ b/main.cpp	Thu Oct 29 18:23:08 2015 +0100
@@ -13,22 +13,25 @@
 #include "buttons.h"
 #include "debug.h"
 #include "emg.h"
+#include "serialcom.h"
 
-Ticker switchesTick, debugTick, motorTick, EMGTick, safetyTick;
-volatile bool switches_go=false, debug_go=false, motor_go=false, emg_go=false, safety_go=false;
+Ticker switchesTick, debugTick, motorTick, EMGTick, safetyTick serialTick;
+volatile bool switches_go=false, debug_go=false, motor_go=false, emg_go=false, safety_go=false, serial_go=false;
 
 void switches_activate(){switches_go=true;};
 void debug_activate(){debug_go=true;};
 void motor_activate(){motor_go=true;};
 void emg_activate(){emg_go=true;};
 void safety_activate(){safety_go=true;};
+void serial_activate(){serial_go=true;};
 
 void tickerAttach(){
     EMGTick.attach(&emg_activate, 0.005f);
     switchesTick.attach(&switches_activate, 0.02f);
-    debugTick.attach(&debug_activate, 0.03f);
+    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.
@@ -38,9 +41,14 @@
 bool tickersActivated = false;
 bool calReady = false; // flag for calibration ready
 
+bool usePotmeters = true;
+bool controlAngle = false;
+bool controlDirection = true;
+
+
 int main(){
     motorInit();
-    calReady = calibrateMotors();
+    calReady = true; // calibrateMotors();
 
     while (true) {
 
@@ -74,6 +82,10 @@
                 motor_go=false;
                 motorControl();
             }
+            if(serial_go){
+                serial_go=false;
+                serialCom();
+            }
         }
     }
 }
\ No newline at end of file