the emg filtering part of the program
Dependencies: HIDScope biquadFilter mbed MODSERIAL
Fork of EMG by
Diff: main.cpp
- Revision:
- 32:e1e5f03e9faf
- Parent:
- 31:9c3b022f1dc3
- Child:
- 33:fcd4568f1c86
--- a/main.cpp Tue Oct 25 10:39:11 2016 +0000 +++ b/main.cpp Tue Oct 25 10:47:29 2016 +0000 @@ -33,7 +33,7 @@ double ref_y=0.000; double speed=0.2; const int negative=-1; -char key; +//char key; // create a variable called 'state', define it @@ -107,40 +107,33 @@ emg22=bqc33.step(fabs(bqc31.step(emg3.read()))); scope.set(5, emg22); - //pc.printf("Hello World!\n"); /* Ensure that enough channels are available (HIDScope scope( 2 )) * Finally, send all channels to the PC at once */ scope.send(); - if (pc.readable()){ - key=pc.getc(); - } - else { - key='p'; - } - if (emg02>threshold&&emg12>threshold&&emg22>threshold || key=='d') { + if (emg02>threshold&&emg12>threshold&&emg22>threshold ) { mystate = STATE_XY_NEG; ref_x=ref_x+speed*negative; ref_y=ref_y+speed*negative; - } else if (emg02>threshold&&emg12>threshold || key=='a') { + } else if (emg02>threshold&&emg12>threshold ) { mystate = STATE_X_NEG; ref_x=ref_x+speed*negative; - } else if (emg02>threshold&&emg22>threshold || key=='s') { + } else if (emg02>threshold&&emg22>threshold) { mystate = STATE_Y_NEG; ref_y=ref_y+speed*negative; - } else if (emg12>threshold&&emg22>threshold || key=='e') { + } else if (emg12>threshold&&emg22>threshold ) { mystate = STATE_XY; ref_x=ref_x+speed; ref_y=ref_y+speed; - } else if (emg12>threshold || key=='q') { + } else if (emg12>threshold ) { mystate = STATE_X; ref_x=ref_x+speed; - } else if (emg22>threshold || key=='w') { + } else if (emg22>threshold ) { mystate = STATE_Y; ref_y=ref_y+speed; } else {