![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
control for robotic arm that can play chess using a granular gripper
Dependencies: Encoder mbed HIDScope Servo MODSERIAL
Fork of chessRobot by
main.cpp
- Committer:
- annesteenbeek
- Date:
- 2015-10-20
- Revision:
- 78:0cc7c64ba94c
- Parent:
- 76:0aa90e728e4a
- Child:
- 79:cf500b63f349
File content as of revision 78:0cc7c64ba94c:
/* ________ ____ __ __ / ____/ /_ ___ __________ / __ \____ / /_ ____ / /_ / / / __ \/ _ \/ ___/ ___/ / /_/ / __ \/ __ \/ __ \/ __/ / /___/ / / / __(__ |__ ) / _, _/ /_/ / /_/ / /_/ / /_ \____/_/ /_/\___/____/____/ /_/ |_|\____/_.___/\____/\__/ */ #include "mbed.h" #include "config.h" // settings and pin configurations #include "actuators.h" #include "buttons.h" #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; void switches_activate(){switches_go=true;}; void debug_activate(){debug_go=true;}; void motor_activate(){motor_go=true;}; void emg_activate(){emg_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); while (true) { if(emg_go){ emg_go=false; readEMG(); } // servoControl(); if(switches_go){ switches_go=false; checkSwitches(); } if(debug_go){ debug_go=false; debugProcess(); } if(motor_go){ motor_go=false; motorControl(); } } }