oke

Dependencies:   MODSERIAL mbed

Fork of EMG2spier by Dan August

Files at this revision

API Documentation at this revision

Comitter:
jorick92
Date:
Fri Oct 25 12:41:14 2013 +0000
Parent:
2:5c6873981eac
Commit message:
oke

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5c6873981eac -r b299102c7d19 main.cpp
--- a/main.cpp	Fri Oct 25 09:40:23 2013 +0000
+++ b/main.cpp	Fri Oct 25 12:41:14 2013 +0000
@@ -4,8 +4,8 @@
 //Define objects
 AnalogIn    emg_biceps(PTB0); //Analog input
 AnalogIn    emg_triceps(PTB1);
-// AnalogIn    emg_flexoren(PTB2);
-// AnalogIn    emg_extensoren(PTB3);
+AnalogIn    emg_flexoren(PTB2);
+AnalogIn    emg_extensoren(PTB3);
 PwmOut      red(LED_RED); // sig_out biceps
 PwmOut      blue(LED_BLUE); // sig_out triceps
 // PwmOut      green(LED_GREEN); 
@@ -69,7 +69,7 @@
     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;
@@ -224,12 +224,18 @@
 
 void looper()
 {
-static float biceps, triceps, extensoren, flexoren, emg_filter_test;
+static float biceps, triceps, extensoren, flexoren, emg_filter_test, dy, dx;
 
     emg_filter_test = filter(1);
-    if (emg_filter_test != -1) biceps = emg_filter_test;
+    if (emg_filter_test != -1) {
+        biceps = emg_filter_test;
+    }
     emg_filter_test = filter(2);
-    if (emg_filter_test != -1) triceps = emg_filter_test;
+    if (emg_filter_test != -1){
+        triceps = emg_filter_test;
+    }
+    dx=biceps-triceps;
+    pc.printf("%.6f\n", dx);
     /*emg_filter_test = filter(3);
     if (emg_filter_test != -1) flexoren = emg_filter_test;
     emg_filter_test = filter(4);