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:
Tanja2211
Date:
Wed Oct 29 08:42:14 2014 +0000
Parent:
46:24e350229ce8
Child:
48:b354afb564f2
Commit message:
als het goed is kloppt het;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Oct 29 08:14:19 2014 +0000
+++ b/main.cpp	Wed Oct 29 08:42:14 2014 +0000
@@ -199,7 +199,12 @@
             pc.printf("drempelwaarde triceps is %f\r\n", drempelwaardeT);
 
             pc.printf("calibratie tricep klaar,\n");
-            wait(3);
+
+            myled1 = 0;
+            myled2 = 0;
+            myled3 = 0;
+
+            wait(2);
 
             myled1=1;
             myled2=1;
@@ -217,14 +222,32 @@
             Calibratie_Biceps();
             drempelwaardeB1=MOVAVG_B-1;
             pc.printf("drempelwaarde snelheid 1 is %f\r\n", drempelwaardeB1);
-            wait(3);
+
+            myled1 = 0;
+            myled2 = 0;
+            myled3 = 0;
+
+            wait(2);
+
+            myled1 = 1;
+            myled2 = 0;
+            myled3 = 1;
 
             pc.printf("calibratie biceps snelheid 2 aan\n");
             wait(2);
             Calibratie_Biceps();
             drempelwaardeB2=MOVAVG_B-1;
             pc.printf("drempelwaarde snelheid 2 is %f\r\n", drempelwaardeB2);
-            wait(3);
+
+            myled1 = 0;
+            myled2 = 0;
+            myled3 = 0;
+
+            wait(2);
+
+            myled1 = 1;
+            myled2 = 0;
+            myled3 = 1;
 
             pc.printf("calibratie biceps snelheid 3 aan\n");
             wait(2);
@@ -232,8 +255,14 @@
             drempelwaardeB3=MOVAVG_B-1;
             pc.printf("drempelwaarde snelheid 3 is %f\r\n", drempelwaardeB3);
 
+            myled1 = 0;
+            myled2 = 0;
+            myled3 = 0;
+
+            wait(2);
+
             pc.printf("caliratie biceps is klaar\n");
-            wait(5);
+            wait(3);
 
             myled1=1;
             myled2=1;
@@ -246,31 +275,28 @@
             myled1 = 1;
             myled2 = 1;
             myled3 = 0;
+            wait(3);
 
             if(drempelwaardeT==0) {
                 pc.printf("geen waarde calibratie TRICEPS \n");
-                wait(3);
                 myled1 = 0;
                 myled2 = 0;
                 myled3 = 0;
             }
             if (drempelwaardeB1==0) {
                 pc.printf("geen waarde calibratie BICEPS 1 \n");
-                wait(3);
                 myled1 = 0;
                 myled2 = 0;
                 myled3 = 0;
             }
             if (drempelwaardeB2==0) {
                 pc.printf("geen waarde calibratie BICEPS 2 \n");
-                wait(3);
                 myled1 = 0;
                 myled2 = 0;
                 myled3 = 0;
             }
             if (drempelwaardeB3==0) {
                 pc.printf("geen waarde calibratie BICEPS 3 \n");
-                wait(3);
                 myled1 = 0;
                 myled2 = 0;
                 myled3 = 0;
@@ -285,6 +311,10 @@
                 arm_biquad_cascade_df1_init_f32(&lowpassT,1,lowpass_const,lowpass_states);
                 arm_biquad_cascade_df1_init_f32(&highpassT,1,highpass_const,highpass_states);
 
+                myled1 = 0;
+                myled2 = 1;
+                myled3 = 1;
+
                 log_timerT1.attach(Triceps, 0.005);
                 wait(5);
                 log_timerT1.detach();
@@ -293,37 +323,49 @@
 
                 // positie van batje met behulp van Triceps
 
-                if (MOVAVG_Positie1>= drempelwaardeT) {
+                if (MOVAVG_Positie1 >= drempelwaardeT) {
                     yT1=1;
+                    
+                     //bepaling van positie met tricep 2
+                    Ticker log_timerT2;
+
+                    arm_biquad_cascade_df1_init_f32(&notchT,1,notch_const,notch_states);
+                    arm_biquad_cascade_df1_init_f32(&lowpassT,1,lowpass_const,lowpass_states);
+                    arm_biquad_cascade_df1_init_f32(&highpassT,1,highpass_const,highpass_states);
+
+                    myled1 = 0;
+                    myled2 = 1;
+                    myled3 = 1;
+
+                    log_timerT2.attach(Triceps, 0.005);
+                    wait(5);
+                    log_timerT2.detach();
+
+                    MOVAVG_T=MOVAVG_Positie2;
+
+                    if (MOVAVG_Positie2 >= drempelwaardeT) {
+                        yT2=1;
+                    } else {
+                        yT2=0;
+                    }
+
+                    pc.printf("Triceps meting 2 is klaar.\n");
+                    myled1 = 1;
+                    myled2 = 1;
+                    myled3 = 0;
+                    wait(3);
+
                 } else {
                     yT1=0;
                 }
 
                 pc.printf("Triceps meting 1 is klaar.\n");
+                myled1 = 1;
+                myled2 = 1;
+                myled3 = 0;
                 wait(3);
 
-                //bepaling van positie met tricep 2
-                Ticker log_timerT2;
-
-                arm_biquad_cascade_df1_init_f32(&notchT,1,notch_const,notch_states);
-                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_timerT2.attach(Triceps, 0.005);
-                wait(5);
-                log_timerT2.detach();
-
-                MOVAVG_T=MOVAVG_Positie2;
-
-                if (MOVAVG_Positie2 >= drempelwaardeT) {
-                    yT2=1;
-                } else {
-                    yT2=0;
-                }
-
-                pc.printf("Triceps meting 2 is klaar.\n");
-                wait(3);
-
+               
                 //*** INPUT MOTOR 2 ***
                 positie=yT1+yT2;
 
@@ -348,6 +390,10 @@
                 arm_biquad_cascade_df1_init_f32(&lowpassB,1,lowpass_const,lowpass_states);
                 arm_biquad_cascade_df1_init_f32(&highpassB,1,highpass_const,highpass_states);
 
+                myled1 = 1;
+                myled2 = 0;
+                myled3 = 1;
+
                 log_timerB.attach(Biceps,0.005);
                 wait(5);
                 log_timerB.detach();
@@ -370,6 +416,9 @@
                     yB1=0;
                 }
                 pc.printf("Biceps meting is klaar.\n");
+                myled1 = 1;
+                myled2 = 1;
+                myled3 = 0;
                 wait(3);
 
                 //*** INPUT MOTOR 1 ***