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 TextLCD mbed-dsp mbed
Fork of EMGmeten by
Revision 6:740f08fad2c3, committed 2014-10-30
- Comitter:
- lauradeheus
- Date:
- Thu Oct 30 17:49:08 2014 +0000
- Parent:
- 5:f93b7068c202
- Child:
- 7:0e76120eb7ad
- Commit message:
- EMGmeten en state aangeven
Changed in this revision
| EMGmeten.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/EMGmeten.cpp Wed Oct 29 16:34:45 2014 +0000
+++ b/EMGmeten.cpp Thu Oct 30 17:49:08 2014 +0000
@@ -27,7 +27,7 @@
float notch_const[] = {0.978048948305681 , 0.000000000000000 , 0.978048948305681 , 0.000000000000000 , -0.956097896611362};
float notch_states[4];
float filtered_emg;
-float EMG_max = 0.16;
+float EMG_max=0.15;
float EMG_treshhold_laag = 0.3*EMG_max;
float EMG_treshhold_hoog = 0.7*EMG_max;
@@ -37,6 +37,7 @@
void looper();
void pieken_tellen();
+void EMG_max_meting();
//char *lcd_r1 = new char[16];
//char *lcd_r2 = new char[16];
@@ -53,26 +54,49 @@
filtered_emg = fabs(filtered_emg);
//emg_value_f32 = fabs(emg_value_f32);
arm_biquad_cascade_df1_f32(&lowpass_2, &filtered_emg, &filtered_emg, 1 );
-
- void pieken_tellen();
- {
- if (filtered_emg>=EMG_treshhold_hoog)
- {
- aanspan=true; //maak een variabele waarin je opslaat dat het signaal hoog is.
- }
- if (aanspan==true && filtered_emg<=EMG_treshhold_laag)//== ipv =, anders wordt aanspan true gemaakt
- {
- aanspan=false;
- aantal_pieken++;
- }
- }
- doel = aantal_pieken-((aantal_pieken/3)*3);
+ //EMG_max_meting();
+ pieken_tellen();
+ doel = aantal_pieken-((aantal_pieken/3)*3)+1;
+
scope.set(0,emg_value); //uint value
scope.set(1,filtered_emg); //processed float
scope.send();
}
+void EMG_max_meting()
+{
+ int i=0; // tijdspad
+ lcd.cls();
+ lcd.printf("Maximale\nEMGmeting");
+ for(i=0; i<300; i++)
+ {
+ wait(0.1);
+ if (filtered_emg>=EMG_max)
+ {
+ EMG_max=filtered_emg;
+ }
+ }
+ lcd.cls();
+ lcd.printf("Maximale EMG\nbepaald");
+ wait(3);
+ EMG_treshhold_laag = 0.3*EMG_max;
+ EMG_treshhold_hoog = 0.7*EMG_max;
+}
+
+void pieken_tellen()
+{
+ if (filtered_emg>=EMG_treshhold_hoog)
+ {
+ aanspan=true; //maak een variabele waarin je opslaat dat het signaal hoog is.
+ }
+ if (aanspan==true && filtered_emg<=EMG_treshhold_laag)//== ipv =, anders wordt aanspan true gemaakt
+ {
+ aanspan=false;
+ aantal_pieken++;
+ }
+}
+
int main()
{
Ticker log_timer;
@@ -93,5 +117,4 @@
/*Everything is handled by the interrupt routine now!*/
//pc.baud(9600);
}
-}
-
\ No newline at end of file
+}
\ No newline at end of file
