emg with text

Dependencies:   HIDScope MODSERIAL biquadFilter mbed

Fork of emg_import by Daniqe Kottelenberg

Revision:
47:ddaa59d48aca
Parent:
46:4a8889f9dc9f
Child:
48:0a16643c9de4
Child:
49:818a0e90ed9c
--- a/main.cpp	Wed Nov 02 16:24:59 2016 +0000
+++ b/main.cpp	Thu Nov 03 08:43:08 2016 +0000
@@ -20,16 +20,15 @@
 DigitalOut green(LED_GREEN);
 
 //motors
-DigitalOut richting_motor1(D4);
-PwmOut pwm_motor1(D5);
-DigitalOut richting_motor2(D7);
-PwmOut pwm_motor2(D6);
+DigitalOut richting_motor1(D7); ///motor 1 aansluiting op motor 1
+PwmOut pwm_motor1(D6);
+DigitalOut richting_motor2(D4);
+PwmOut pwm_motor2(D5);
 
 //=====================================================================================
 //define variables
 //other
-int    onoffsignal_rightarm=0;              // on/off signal: 1; biceps activation, 0: nothing, -1, triceps activation
-int    switch_signal_leftarm=0;             // switching between motors. 
+
 double cut_off_value_biceps_right =0.04;              //gespecificeerd door floortje
 double cut_off_value_biceps_left=-0.04;
 double cut_off_value_triceps=-0.04;             
@@ -75,16 +74,20 @@
         switch_signal++;
         green=!green;
         red=!red;
+        
     if (switch_signal%2==0)  
+     {pc.printf("If you contract the biceps, the robot will go right \r\n");
+     pc.printf("If you contract the triceps, the robot will go left \r\n");
+     pc.printf("\r\n");
+     }
+       
+    
+    else
      {pc.printf("If you contract the biceps, the robot will go up \r\n");
      pc.printf("If you contract the triceps, the robot will go down \r\n");
+    pc.printf("\r\n");
      }
-    
-    else
-     {pc.printf("If you contract the biceps, the robot will go right \r\n");
-     pc.printf("If you contract the triceps, the robot will go left \r\n");
-     }
-        
+     
     }    
     }
     
@@ -155,20 +158,25 @@
 int main()
 {  
 pc.baud(115200);
-green=0;
-red=1;
+green=1;
+red=0;
 
 sample_timer.attach(&filter, 0.001);        //continously execute the EMG reader and filter, it ensures that filter and sampling is executed every 1/frequency seconds
 ticker_switch.attach(&switch_function,1.0);
 
-if (switch_signal%2==0)  
+pc.printf("We will start the demonstration\r\n");
+
+    if (switch_signal%2==0)  
+     {pc.printf("If you contract the biceps, the robot will go right \r\n");
+     pc.printf("If you contract the triceps, the robot will go left \r\n");
+      pc.printf("\r\n");
+     }
+       
+    
+    else
      {pc.printf("If you contract the biceps, the robot will go up \r\n");
      pc.printf("If you contract the triceps, the robot will go down \r\n");
-     }
-    
-    else
-     {pc.printf("If you contract the biceps, the robot will go right \r\n");
-     pc.printf("If you contract the triceps, the robot will go left \r\n");
+      pc.printf("\r\n");
      }
      
 //==============================================================================================