emg_mk

Dependencies:   HIDScope MODSERIAL mbed-dsp mbed

Files at this revision

API Documentation at this revision

Comitter:
Tanja2211
Date:
Thu Oct 23 13:28:31 2014 +0000
Parent:
11:5044290660b0
Commit message:
poging

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5044290660b0 -r 197b7ca8dbe2 main.cpp
--- a/main.cpp	Thu Oct 23 12:13:04 2014 +0000
+++ b/main.cpp	Thu Oct 23 13:28:31 2014 +0000
@@ -89,12 +89,9 @@
 
     //Triceps filteren
     arm_biquad_cascade_df1_f32(&highpassT, &emg_value_f32T, &filtered_emgT, 1 );
+    filtered_emgT = fabs(filtered_emgT);
     arm_biquad_cascade_df1_f32(&lowpassT, &filtered_emgT, &filtered_emgT, 1 );
-    filtered_emgT = fabs(filtered_emgT);
-
-    //sturen naar scherm (Realterm)
-    pc.printf("%f\r\n",filtered_emgT);//u=f filtered_emgT is een float
-
+    
     //Triceps moving average
     T0=filtered_emgT;
     MOVAVG_T=T0*0.1+T1*0.1+T2*0.1+T3*0.1+T4*0.1+T5*0.1+T6*0.1+T7*0.1+T8*0.1+T9*0.1;
@@ -107,6 +104,9 @@
     T3=T2;
     T2=T1;
     T1=T0;
+    
+    //sturen naar scherm (Realterm)
+    pc.printf("%f\r\n",MOVAVG_T);//u=f filtered_emgT is een float
 
     //sturen naar HID Scope
     scope.set(0,emg_valueT);        //ruwe data
@@ -122,12 +122,9 @@
 
     //Biceps filteren
     arm_biquad_cascade_df1_f32(&highpassB, &emg_value_f32B, &filtered_emgB, 1 );
+    filtered_emgB = fabs(filtered_emgB);
     arm_biquad_cascade_df1_f32(&lowpassB, &filtered_emgB, &filtered_emgB, 1 );
-    filtered_emgB = fabs(filtered_emgB);
-
-    //sturen naar scherm
-    pc.printf("%f\r\n",filtered_emgB);
-
+    
     //Biceps moving average
     B0=filtered_emgB;
     MOVAVG_B=B0*0.1+B1*0.1+B2*0.1+B3*0.1+B4*0.1+B5*0.1+B6*0.1+B7*0.1+B8*0.1+B9*0.1;
@@ -140,6 +137,9 @@
     B3=B2;
     B2=B1;
     B1=B0;
+    
+    //sturen naar scherm
+    pc.printf("%f\r\n",MOVAVG_B);
 
     //naar HID Scope
     scope.set(2,emg_valueB);        //ruwe data
@@ -157,8 +157,8 @@
     arm_biquad_cascade_df1_init_f32(&lowpassT,1,lowpass_const,lowpass_states);
     arm_biquad_cascade_df1_init_f32(&highpassT,1,highpass_const,highpass_states);
 
-    log_timerT.attach(Triceps, 0.005);
-    wait(60); //log_timerT wordt 2000 keer uitgevoerd
+    log_timerT.attach(Triceps, 0.01);
+    wait(250); //log_timerT wordt 2000 keer uitgevoerd
     log_timerT.detach();
     
     // positie van batje met behulp van Triceps
@@ -199,7 +199,7 @@
     arm_biquad_cascade_df1_init_f32(&highpassB,1,highpass_const,highpass_states);
 
     log_timerB.attach(Biceps,0.005);
-    wait(60);//log_timerB wordt 2000 keer uitgevoerd
+    wait(250);//log_timerB wordt 2000 keer uitgevoerd
     log_timerB.detach();
     
     //bepaling van snelheidsstand met biceps