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

Dependencies:   Encoder mbed HIDScope Servo MODSERIAL

Fork of chessRobot by a steenbeek

main.cpp

Committer:
annesteenbeek
Date:
2015-10-12
Revision:
57:43f707648f2b
Parent:
56:f730962fbb53
Child:
59:fe00be2cf8fd

File content as of revision 57:43f707648f2b:

#include "mbed.h"
#include "config.h"  // settings and pin configurations
#include "actuators.h"
#include "buttons.h"
#include "debug.h"

int a = 3;
Ticker switches, debug, motor;
volatile bool switches_go=false, debug_go=false, motor_go=false;

void switches_activate(){switches_go=true;};
void debug_activate(){debug_go=true;};
void motor_activate(){motor_go=true;};

float motorCall = 0.001; // set motor frequency global so it can be used for speed.

int main(){
motorInit(); 
// calibrateMotors();

switches.attach(&switches_activate, 0.02f);
debug.attach(&debug_activate, 0.03f);
motor.attach(&motor_activate, motorCall);

    while (true) {
        // readEMG();
        // servoControl();
        if(switches_go){
            switches_go=false;
            checkSwitches();
        }
        if(debug_go){
            debug_go=false;
            debugProcess();
        }
        if(motor_go){
            motor_go=false;
            motorControl();
        }
    }
}