emg

Dependencies:   HIDScope MODSERIAL mbed-dsp mbed TouchButton

Fork of test by BMT M9 Groep01

Files at this revision

API Documentation at this revision

Comitter:
s1340735
Date:
Tue Oct 28 10:28:30 2014 +0000
Parent:
32:36bb6af01689
Child:
34:514440ddca9a
Commit message:
pretty

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Oct 28 10:18:53 2014 +0000
+++ b/main.cpp	Tue Oct 28 10:28:30 2014 +0000
@@ -22,30 +22,28 @@
 *  1  *  2  *  3  *  4  *
 *     *     *     *     *
 *************************
-* key 1 will light Red LED
-* key 2 will light Green LED
-* key 3 will light Blue LED
-* key 4 will light White LED (R+G+B)
+* key 1 will light Red LED                  -> CALIBRATIE TRICEPS
+* key 2 will light Green LED                -> CALIBRATIE BICEPS
+* key 3 will light Blue LED                 -> START
+* key 4 will light White LED (R+G+B)        -> ?
 */
 
 //*** OBJECTS ***
 //bicep
-uint16_t emg_valueB, emg_valueB_calibratie;
-float emg_value_f32B, emg_value_f32B_calibratie;
-float filtered_emgB, filtered_emgB_calibratie;
+uint16_t emg_valueB;
+float emg_value_f32B;
+float filtered_emgB;
 float drempelwaardeB1, drempelwaardeB2, drempelwaardeB3;//B1=snelheidsstand 1, B2=snelheidsstand 2, B3=snelheidsstand 3
 int yB1, yB2, yB3;
-float MOVAVG_B_caliratie;
 float B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B21, B22, B23, B24, B25, B26, B27, B28, B29, MOVAVG_B; //moving average objects
 float B30, B31, B32, B33, B34, B35, B36, B37, B38, B39, B40, B41, B42, B43, B44, B45, B46, B47, B48, B49, B50, B51, B52, B53, B54, B55, B56, B57, B58, B59;
 int snelheidsstand;
 //tricep
-uint16_t emg_valueT, emg_valueT_calibratie;
-float emg_value_f32T, emg_value_f32T_calibratie;
-float filtered_emgT, filtered_emgT_calibratie;
+uint16_t emg_valueT;
+float emg_value_f32T;
+float filtered_emgT;
 float drempelwaardeT;
 int yT1, yT2;
-float MOVAVG_T_calibratie;
 float T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29,MOVAVG_T; //moving average objects
 float MOVAVG_Positie1, MOVAVG_Positie2;
 int positie;
@@ -88,35 +86,9 @@
     //Triceps moving average
     T0=filtered_emgT*100;
     MOVAVG_T=T0*0.03333+T1*0.03333+T2*0.03333+T3*0.03333+T4*0.03333+T5*0.03333+T6*0.03333+T7*0.03333+T8*0.03333+T9*0.03333+T10*0.03333+T11*0.03333+T12*0.03333+T13*0.03333+T14*0.03333+T15*0.03333+T16*0.03333+T17*0.03333+T18*0.03333+T19*0.03333+T20*0.03333+T21*0.03333+T22*0.03333+T23*0.03333+T24*0.03333+T25*0.03333+T26*0.03333+T27*0.03333+T28*0.03333+T29*0.03333;
-    T29=T28;
-    T28=T27;
-    T27=T26;
-    T26=T25;
-    T25=T24;
-    T24=T23;
-    T23=T22;
-    T22=T21;
-    T21=T20;
-    T20=T19;
-    T19=T18;
-    T18=T17;
-    T17=T16;
-    T16=T15;
-    T15=T14;
-    T14=T13;
-    T13=T12;
-    T12=T11;
-    T11=T10;
-    T10=T9;
-    T9=T8;
-    T8=T7;
-    T7=T6;
-    T6=T5;
-    T5=T4;
-    T4=T3;
-    T3=T2;
-    T2=T1;
-    T1=T0;
+    T29=T28,     T28=T27,     T27=T26,     T26=T25,     T25=T24,     T24=T23,     T23=T22,     T22=T21,     T21=T20,     T20=T19,     T19=T18,     T18=T17;
+    T17=T16,     T16=T15,     T15=T14,     T14=T13,     T13=T12,     T12=T11,     T11=T10,     T10=T9,      T9=T8,       T8=T7,       T7=T6,       T6=T5;
+    T5=T4,       T4=T3,       T3=T2,       T2=T1,       T1=T0;
 
     //sturen naar scherm (Realterm)
     pc.printf("%f\r\n",MOVAVG_T);
@@ -143,65 +115,12 @@
     //Biceps moving average
     B0=filtered_emgB*1000;
     MOVAVG_B=B0*0.01667+B1*0.01667+B2*0.01667+B3*0.01667+B4*0.01667+B5*0.01667+B6*0.01667+B7*0.01667+B8*0.01667+B9*0.01667+B10*0.01667+B11*0.01667+B12*0.01667+B13*0.01667+B14*0.01667+B15*0.01667+B16*0.01667+B17*0.01667+B18*0.01667+B19*0.01667+B20*0.01667+B21*0.01667+B22*0.01667+B23*0.01667+B24*0.01667+B25*0.01667+B26*0.01667+B27*0.01667+B28*0.01667+B29*0.01667+B30*0.01667+B31*0.01667+B32*0.01667+B33*0.01667+B34*0.01667+B35*0.01667+B36*0.01667+B37*0.01667+B38*0.01667+B39*0.01667+B40*0.01667+B41*0.01667+B42*0.01667+B43*0.01667+B44*0.01667+B45*0.01667+B46*0.01667+B47*0.01667+B48*0.01667+B49*0.01667+B50*0.01667+B51*0.01667+B52*0.01667+B53*0.01667+B54*0.01667+B55*0.01667+B56*0.01667+B57*0.01667+B58*0.01667+B59*0.01667;
-    B59=B58;
-    B58=B57;
-    B57=B56;
-    B56=B55;
-    B55=B54;
-    B54=B53;
-    B53=B52;
-    B52=B51;
-    B51=B50;
-    B50=B48;
-    B49=B49;
-    B48=B47;
-    B47=B46;
-    B46=B45;
-    B45=B44;
-    B44=B43;
-    B43=B42;
-    B42=B41;
-    B41=B40;
-    B40=B39;
-    B39=B38;
-    B38=B37;
-    B37=B36;
-    B36=B35;
-    B35=B34;
-    B34=B33;
-    B33=B32;
-    B32=B31;
-    B31=B30;
-    B30=B29;
-    B29=B28;
-    B28=B27;
-    B27=B26;
-    B26=B25;
-    B25=B24;
-    B24=B23;
-    B23=B22;
-    B22=B21;
-    B21=B20;
-    B20=B19;
-    B19=B18;
-    B18=B17;
-    B17=B16;
-    B16=B15;
-    B15=B14;
-    B14=B13;
-    B13=B12;
-    B12=B11;
-    B11=B10;
-    B10=B9;
-    B9=B8;
-    B8=B7;
-    B7=B6;
-    B6=B5;
-    B5=B4;
-    B4=B3;
-    B3=B2;
-    B2=B1;
-    B1=B0;
+    B59=B58,     B58=B57,     B57=B56,     B56=B55,     B55=B54,     B54=B53,     B53=B52,     B52=B51,     B51=B50,     B50=B48,     B49=B49;
+    B48=B47,     B47=B46,     B46=B45,     B45=B44,     B43=B42,     B42=B41,     B41=B40,     B40=B39,     B39=B38,     B38=B37,     B37=B36;
+    B36=B35,     B35=B34,     B34=B33,     B33=B32,     B32=B31,     B31=B30,     B30=B29,     B29=B28,     B28=B27,     B27=B26,     B26=B25;
+    B25=B24,     B24=B23,     B23=B22,     B22=B21,     B21=B20,     B20=B19,     B19=B18,     B18=B17,     B17=B16,     B16=B15,     B15=B14;
+    B14=B13,     B13=B12,     B12=B11,     B11=B10,     B10=B9,      B9=B8,       B8=B7,       B7=B6,       B6=B5,       B5=B4,       B4=B3;
+    B3=B2,       B2=B1,       B1=B0;
 
     //sturen naar scherm
     pc.printf("%f\r\n",MOVAVG_B);
@@ -417,6 +336,14 @@
                     }
                 }
             }
+        } else if(key==3) {
+            myled1 = 0;
+            myled2 = 1;
+            myled3 = 1;
+            wait(0.1);
+
+            pc.printf("onbekend\n");
+
         } else {
             pc.printf("voer eerst een calibratie uit\n");
         }