emg_mk

Dependencies:   HIDScope MODSERIAL mbed-dsp mbed

Files at this revision

API Documentation at this revision

Comitter:
s1340735
Date:
Tue Oct 21 14:27:50 2014 +0000
Parent:
0:abe0bc5c43b7
Child:
2:a86b09b00008
Commit message:
biceps klaar. nu nog triceps toevoegen

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Oct 21 13:51:54 2014 +0000
+++ b/main.cpp	Tue Oct 21 14:27:50 2014 +0000
@@ -12,7 +12,7 @@
 float drempelwaardeB1, drempelwaardeB2, drempelwaardeB3;//B1=snelheidsstand 1, B2=snelheidsstand 2, B3=snelheidsstand 3
 int yB1, yB2, yB3;
 float B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, MOVAVG_B;//moving average objects
-
+int snelheidsstand;
 
 //*** FILTERS ***
 arm_biquad_casd_df1_inst_f32 lowpass;
@@ -69,13 +69,20 @@
     scope.set(1,MOVAVG_B);
     scope.send();
 
+// *** TRICEP EMG ***
+void Triceps(){
 
 // *** MAIN ***
     int main() {
 
-
+        Ticker log_timer;
+        arm_biquad_cascade_df1_init_f32(&lowpass,1,lowpass_const,lowpass_states);
+        arm_biquad_cascade_df1_init_f32(&highpass,1,highpass_const,highpass_states);
 
+        log_timer.attach(Biceps, 0.005);
+        while(1) {}
 
+        //aansturing
         if (filtered_emgB >= drempelwaardeB1) {
             yB1=1;
             if (filtered_emgB >= drempelwaardeB2) {
@@ -92,4 +99,24 @@
             yB1=0;
         }
 
+        //controle
+        snelheidsstand=yB1+yB2+yB3;
 
+        if (snelheidsstand==1) {
+            pc.printf("Motor 1 beweegt met snelheid 1\n");
+        } else {
+            pc.printf("Motor 1 beweegt niet met snelheid 1\n");
+        }
+        if (snelheidsstand==2) {
+            pc.printf("Motor 1 beweegt met snelheid 2\n");
+        } else {
+            pc.printf("Motor 1 beweegt niet met snelheid 2\n");
+        }
+        if (snelheidsstand==3) {
+            pc.printf("Motor 1 beweegt met snelheid 3\n");
+        } else {
+            pc.printf("Motor 1 beweegt niet met snelheid 3\n");
+        }
+    }
+}
+