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:
79:cf500b63f349
Parent:
78:0cc7c64ba94c
Child:
81:71e7e98deb2c
diff -r 0cc7c64ba94c -r cf500b63f349 main.cpp
--- a/main.cpp	Tue Oct 20 12:58:13 2015 +0200
+++ b/main.cpp	Tue Oct 20 13:21:29 2015 +0200
@@ -14,31 +14,36 @@
 #include "debug.h"
 #include "emg.h"
 
-Ticker switches, debug, motor, EMG;
-volatile bool switches_go=false, debug_go=false, motor_go=false, emg_go= false;
+Ticker switchesTick, debugTick, motorTick, EMGTick, safetyTick;
+volatile bool switches_go=false, debug_go=false, motor_go=false, emg_go=false, safety_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;};
 
 double motorCall = 0.01; // set motor frequency global so it can be used for speed.
 int main(){
 motorInit();    
 calibrateMotors(); // start calibration procedure
 
-switches.attach(&switches_activate, 0.02f);
-debug.attach(&debug_activate, 0.03f);
-motor.attach(&motor_activate, motorCall);
-EMG.attach(&emg_activate, 0.005f);
+switchesTick.attach(&switches_activate, 0.02f);
+debugTick.attach(&debug_activate, 0.03f);
+motorTick.attach(&motor_activate, motorCall);
+EMGTick.attach(&emg_activate, 0.005f);
+safetyTick.attach(&safety_activate, 0.001f);
 
 
     while (true) {
+        if(safety_go){
+            safety_go=false;
+            Safety();
+        }
         if(emg_go){
             emg_go=false;
             readEMG();
         }
-        // servoControl();
         if(switches_go){
             switches_go=false;
             checkSwitches();
@@ -50,6 +55,7 @@
         if(motor_go){
             motor_go=false;
             motorControl();
+        // servoControl();
         }
     }
 }
\ No newline at end of file