EMG test for robot is working (to get thresholds)

Dependencies:   HIDScope biquadFilter mbed

Fork of EMG_prog_robot by Marieke M

Files at this revision

API Documentation at this revision

Comitter:
GerhardBerman
Date:
Wed Nov 02 13:22:42 2016 +0000
Parent:
3:35103d6e7d2a
Commit message:
EMG Test to check EMG function on robot

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 35103d6e7d2a -r 24e2a5e50387 main.cpp
--- a/main.cpp	Wed Nov 02 10:48:31 2016 +0000
+++ b/main.cpp	Wed Nov 02 13:22:42 2016 +0000
@@ -10,8 +10,8 @@
 HIDScope    scope( 5 );
 
 Ticker      filter_timer, send_timer;
-DigitalOut  led1(LED_RED);
-DigitalOut  led2(LED_BLUE);
+DigitalOut  ledRed(LED_RED);
+DigitalOut  ledBlue(LED_BLUE);
 
 volatile bool filter_timer_go=false,send_timer_go=false;
 
@@ -22,8 +22,8 @@
 //double biceps_r = 0;
 //double outRenvelope, outLenvelope;
 int T=4;
-double threshold_l=0.025;
-double threshold_r = 0.025;
+double threshold_l=0.09;
+double threshold_r = 0.09;
 
 
 
@@ -71,10 +71,10 @@
         //pc.printf("right: %f    ",biceps_r);
         //pc.printf("left:  %f\n\r",biceps_l);
         //wait(0.5);
-        Tout = -1;
+        Tout = 2;
         //pc.printf("T=%d\n\r",T);
-        led1=!led1;//blink purple
-        led2=!led2;
+        ledRed=!ledRed;//blink purple
+        ledBlue=!ledBlue;
         }
     else if (biceps_l > threshold_l && biceps_r <= threshold_r){
         //arm 1 activated, move left
@@ -82,10 +82,10 @@
         //pc.printf("right: %f    ",biceps_r);
         //pc.printf("left:  %f\n\r",biceps_l);
         //wait(0.5);
-        Tout  = -2;
+        Tout  = -1;
         //pc.printf("T=%d\n\r",T);
-        led2=1;//off
-        led1=0;//on    red
+        ledBlue=1;//off
+        ledRed=0;//on    red
         }
     else if (biceps_l <= threshold_l && biceps_r > threshold_r){
         //arm 1 activated, move right
@@ -93,18 +93,18 @@
         //pc.printf("right: %f    ",biceps_r);
         //pc.printf("left:  %f\n\r",biceps_l);
         //wait(0.5);
-        Tout = 2;
+        Tout = 1;
         //pc.printf("T=%d\n\r",T);
-        led2=0;//on    blue
-        led1=1;//off
+        ledBlue=0;//on    blue
+        ledRed=1;//off
         }
     else{
         //wait(0.2);
-        led1 = 1;
-        led2 = 1;  //off
+        ledRed = 1;
+        ledBlue = 1;  //off
         //pc.printf("Nothing...   ");
         //wait(0.5);
-        Tout = 5;
+        Tout = -2;
         //pc.printf("right: %f    ",biceps_r);
         //pc.printf("left:  %f\n\r",biceps_l);
         }
@@ -175,9 +175,9 @@
 int main()
 {   
     //pc.baud(SERIAL_BAUD);
-    led1=1;
-    led2=1; 
-    led1=0; //red
+    ledRed=1;
+    ledBlue=1; 
+    ledRed=0; //red
 
     bcq1R.add(&bq1R).add(&bq2R);
     bcq2R.add(&bq3R);