Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HIDScope MODSERIAL QEI biquadFilter mbed
Fork of emg_import by
Diff: main.cpp
- Revision:
- 10:7255b59224cc
- Parent:
- 9:464c447ce82d
- Child:
- 11:b72827754bc3
- Child:
- 12:a76f9b33fbcb
--- a/main.cpp Fri Oct 21 14:07:00 2016 +0000
+++ b/main.cpp Mon Oct 24 08:44:48 2016 +0000
@@ -13,20 +13,18 @@
//define variables
double emg_0_value;
-double emg_gefilterd_high;
-double emg_gefilterd_low;
+double emg_gefilterd;
double emg_abs;
int onoffsignal=0;
double cut_off_value=0.05; //gespecifeerd door floortje
-biquadFilter filterhigh1(9.1497e-01,-1.8299e+00,9.1497e-01, -1.8227e+00, 8.3718e-01);
-biquadFilter filterlow1 (3.9130e-05, 7.8260e-05, 3.9130e-05, -1.9822e+00, 9.8239e-01);
+biquadFilter filterhigh1(0.9565, -1.9131, 0.9565, -1.9112, 0.9150);
+
void filter(){
- emg_0_value=emg0.read(); //read the emg value from the elektrodes
- emg_gefilterd_high= filterhigh1.step(emg_0_value);
- emg_abs=abs(emg_gefilterd_high);
- emg_gefilterd_low = filterlow1.step(emg_abs);
+ emg_0_value=emg0.read(); //read the emg value from the electrodes
+ emg_gefilterd= filterhigh1.step(emg_0_value);
+ emg_abs=abs(emg_gefilterd);
led=!led;
if (emg_abs>cut_off_value)
@@ -37,7 +35,7 @@
//send signals to scope
scope.set(0, emg_0_value ); //set emg signal to scope in channel 1
- scope.set(1, emg_gefilterd_low);
+ scope.set(1, emg_gefilterd );
scope.set(2, onoffsignal);
scope.send(); //send all the signals to the scope
}
@@ -55,7 +53,7 @@
if (onoffsignal==1)
{
richting_motor1 = 0; //motordirection (ccw)
- pwm_motor1 = 5; //motorspeed 1
+ pwm_motor1 = 1; //motorspeed 1
}
else if(onoffsignal==0)
