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 biquadFilter mbed MODSERIAL
Revision 7:87d9904c1c19, committed 2015-10-27
- Comitter:
- Technical_Muffin
- Date:
- Tue Oct 27 10:49:59 2015 +0000
- Parent:
- 6:ec965bb75d40
- Commit message:
- working emg code, commented
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r ec965bb75d40 -r 87d9904c1c19 main.cpp
--- a/main.cpp Tue Oct 27 10:35:00 2015 +0000
+++ b/main.cpp Tue Oct 27 10:49:59 2015 +0000
@@ -44,7 +44,7 @@
//pc.printf("emg signal %f, filtered signal %f \n",emg_value,onoffsignal);
}
}
-void checkmotor(){
+void checkmotor(){//check the normalized signal and set actions if a threshold is passed
if(calyes==1){
if(onoffsignal<=0.25){
led1.write(1);
@@ -57,9 +57,9 @@
}
}
-void calibri(){
+void calibri(){//calibration function
if(button1.read()==false){
- for(int n =0; n<5000;n++){
+ for(int n =0; n<5000;n++){//read for 5000 samples as calibration
emg_value = emg.read();//read the emg value from the elektrodes
signalpart1 = notch.step(emg_value);//Highpass filter for removing offset and artifacts
signalpart2 = filterhigh1.step(signalpart1);//rectify the filtered signal
@@ -67,13 +67,11 @@
signalpart4 = filterlow1.step(signalpart3);//notch filter to remove 50Hz signal
signalfinal = filterlow2.step(signalpart4);//2nd low pass filter to envelope the emg
double signalmeasure = signalfinal;
- pc.printf("%f \n", signalmeasure);
- if (signalmeasure > maxcal){
+ if (signalmeasure > maxcal){//determine what the highest reachable emg signal is
maxcal = signalmeasure;
}
}
calyes=1;
- pc.printf("the max emg value is %f and calyes is %d", maxcal, calyes);
}
}
int main()
@@ -88,6 +86,6 @@
while(1){
-
+ //random while loop to keep system going
}
}
\ No newline at end of file