Meting en filter voor 2 spieren

Dependencies:   MODSERIAL mbed

Revision:
1:fb33955ca402
Parent:
0:3a1196d78030
Child:
2:5c6873981eac
--- a/main.cpp	Fri Oct 25 08:34:03 2013 +0000
+++ b/main.cpp	Fri Oct 25 09:30:58 2013 +0000
@@ -47,7 +47,8 @@
     //the assignents are only executed the first iteration.
            
     //variabelen biceps definieren
-    static float in0_biceps =0 , in1_biceps =0, in2_biceps = 0, in3_biceps = 0, in4_biceps = 0;
+    float in0_biceps =0;
+    static float in1_biceps =0, in2_biceps = 0, in3_biceps = 0, in4_biceps = 0;
     static float out0_biceps = 0, out1_biceps = 0 , out2_biceps = 0, out3_biceps = 0, out4_biceps = 0;
    
     // variabelen triceps definieren
@@ -68,20 +69,20 @@
     static float square_biceps = 0, square_triceps = 0, square_flexoren = 0, square_extensoren = 0;
     static float sum_biceps = 0, sum_triceps = 0, sum_flexoren = 0, sum_extensoren = 0; 
     static float mean_biceps = 0.1, mean_triceps = 0.1, mean_flexoren = 0.1, mean_extensoren = 0.1;
-    static float EMG_biceps, EMG_triceps, EMG_flexoren, EMG_extensoren // output ruwe EMG
+    static float emg_biceps, emg_triceps, emg_flexoren, emg_extensoren; // output ruwe EMG
     static float sig_in_biceps, sig_in_triceps, sig_in_extensoren, sig_in_flexoren; // naam gewijzigd, output StDev
     static float sig_out_biceps, sig_out_triceps, sig_out_extensoren, sig_out_flexoren;
-    float emg_abs, sig_out, deltaV
-    static float sig_prev_biceps = 0, sig_prev_triceps = 0, sig_prev_extensoren = 0, sig_prev_flexoren = 0
-    static int stat0_biceps, stat0_triceps, stat0_extensoren, stat0_flexoren
-    static int stat1_biceps = 0, stat1_triceps = 0, stat1_extensoren = 0, stat1_flexoren = 0
+    float emg_abs, sig_out, deltaV;
+    static float sig_prev_biceps = 0, sig_prev_triceps = 0, sig_prev_extensoren = 0, sig_prev_flexoren = 0;
+    static int stat0_biceps, stat0_triceps, stat0_extensoren, stat0_flexoren;
+    static int stat1_biceps = 0, stat1_triceps = 0, stat1_extensoren = 0, stat1_flexoren = 0;
  
     switch (signal_number){
         case 1:
             //biceps filteren
             in4_biceps = in3_biceps; in3_biceps = in2_biceps; in2_biceps = in1_biceps; in1_biceps = in0_biceps;
             in0_biceps = emg_biceps.read();
-            out4_biceps 2= out3_biceps; out3_biceps = out2_biceps; out2_biceps = out1_biceps; out1_biceps = out0_biceps;           
+            out4_biceps = out3_biceps; out3_biceps = out2_biceps; out2_biceps = out1_biceps; out1_biceps = out0_biceps;           
             out0_biceps = (NUM0*in0_biceps + NUM1*in1_biceps + NUM2*in2_biceps + NUM3*in3_biceps + NUM4*in4_biceps - DEN1*out1_biceps - DEN2*out2_biceps - DEN3*out3_biceps - DEN4*out4_biceps ) / DEN0;                      
             
             //std deviatie bepalen, om de N metingen
@@ -95,7 +96,7 @@
                     mean_biceps = sum_biceps/count_biceps;
                     count_biceps = 0; square_biceps = 0; sum_biceps = 0; // en neem de RMS als er genoeg zijn geteld, stuur die door, en reset sqaure en count
                     // nieuw:
-                    deltaV = sig_in_biceps - sig_prev_biceps
+                    deltaV = sig_in_biceps - sig_prev_biceps;
                     if (sig_in_biceps <= threshold_biceps) // threshold
                     {   stat0_biceps = 0;
                         if (stat1_biceps == 1)
@@ -142,7 +143,7 @@
                 {   sig_in_triceps = sqrt(square_triceps/count_triceps);
                     mean_triceps = sum_triceps/count_triceps;
                     count_triceps = 0; square_triceps = 0; sum_triceps = 0;// en neem de RMS als er genoeg zijn geteld, stuur die door, en reset sqaure en count
-                    deltaV = sig_in_triceps - sig_prev_triceps
+                    deltaV = sig_in_triceps - sig_prev_triceps;
                     if (sig_in_triceps <= threshold_triceps) // threshold
                     {   stat0_triceps = 0;
                         if (stat1_triceps == 1)
@@ -252,7 +253,7 @@
     timer.attach(looper, 0.001);
     while(1) // Loop
     {   
-            // blue = sig_out_biceps;
+            // zie 'encoder' , timer bepaalt wanneer een if in de while-loop berekeningen doet voor de motor.
         
     }
 }