Combination code of movement and emg code with small changes for 2 motors.
Dependencies: HIDScope MODSERIAL QEI biquadFilter mbed
Fork of EMG_converter_code by
Diff: main.cpp
- Revision:
- 10:4af887af3a47
- Parent:
- 9:ba7294959988
- Child:
- 11:8196434745b4
--- a/main.cpp Tue Oct 27 22:00:46 2015 +0000 +++ b/main.cpp Wed Oct 28 11:02:52 2015 +0000 @@ -78,6 +78,7 @@ onoffsignal1=signalfinal1/maxcal;//divide the emg signal by the max EMG to calibrate the signal per person scope.set(0,emg_value1);//set emg signal to scope in channel 1 scope.set(1,onoffsignal1);//set filtered signal to scope in channel 2 + pc.printf("the emg 1 signal is: %f \n",onoffsignal1); scope.send();//send the signals to the scope //pc.printf("emg signal %f, filtered signal %f \n",emg_value,onoffsignal); } @@ -94,6 +95,7 @@ onoffsignal2=signalfinal2/maxcal;//divide the emg signal by the max EMG to calibrate the signal per person scope.set(2,emg_value2);//set emg signal to scope in channel 1 scope.set(3,onoffsignal2);//set filtered signal to scope in channel 2 + pc.printf("the emg 2 signal is: %f \n",onoffsignal2); scope.send();//send the signals to the scope //pc.printf("emg signal %f, filtered signal %f \n",emg_value,onoffsignal); } @@ -177,8 +179,8 @@ led3.write(1); speed1.write(0); speed2.write(0); - sample_timer1.attach(&filter1, 0.002);//continously execute the EMG reader and filter - sample_timer2.attach(&filter2, 0.002);//continously execute the EMG reader and filter + sample_timer1.attach(&filter1, 0.005);//continously execute the EMG reader and filter +// sample_timer2.attach(&filter2, 0.005);//continously execute the EMG reader and filter //motor_timer1.attach(&checkmotor1, 0.002);//continously execute the motor controller //motor_timer2.attach(&checkmotor2, 0.002);//continously execute the motor controller // cal_timer.attach(&calibri, 0.002);//ticker to check if motor is being calibrated