![](/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
Diff: emg.cpp
- Revision:
- 78:0cc7c64ba94c
- Parent:
- 75:9995528bf8b7
- Child:
- 80:8f030bd5dd15
--- a/emg.cpp Tue Oct 20 12:36:12 2015 +0200 +++ b/emg.cpp Tue Oct 20 12:58:13 2015 +0200 @@ -1,20 +1,22 @@ +#include "emg.h" #include "filter_constants.h" // All constants for EMG processing -#include "emg.h" - #include "mbed.h" -#include "HIDScope.h" - - +#define enableLed // Define objects AnalogIn emg1(A0); // Analog input 1 AnalogIn emg2(A1); // Analog input 2 -DigitalOut ledred(LED_RED); // Red led -DigitalOut ledgreen(LED_GREEN); // Green led -DigitalOut ledblue(LED_BLUE); // Blue led +#ifdef enableLEd + DigitalOut ledred(LED_RED); // Red led + DigitalOut ledgreen(LED_GREEN); // Green led + DigitalOut ledblue(LED_BLUE); // Blue led +#else + DigitalOut ledred(d0); // Red led + DigitalOut ledgreen(d0); // Green led + DigitalOut ledblue(d0); // Blue led +#endif Ticker sample_tick; // Ticker for sampling Ticker output; // Ticker for PC output -HIDScope scope(6); // Number of scopes Timer normalizing_timer; // Timer for normalizing Timer EMG_timer; // Timer for switch statement @@ -221,8 +223,7 @@ } -void readEMG() -{ +void readEMG(){ if(mode==normalize && normalizing_timer.read_ms() == 0) { // Start normalizing timer normalizing_timer.reset(); normalizing_timer.start(); @@ -310,13 +311,7 @@ } // Graphical output to HIDScope for debugging/ program check - scope.set(0,emg_filt_val2); - scope.set(1,x_velocity); - scope.set(2,y_velocity); - scope.set(3,pump); - scope.set(4,DOF); - scope.set(5,DOF); - scope.send(); + }