Daniqe Kottelenberg / Mbed 2 deprecated oooo

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Fork of emg_import by Daniqe Kottelenberg

Revision:
49:e28c752d826f
Parent:
48:d6894723d9bf
diff -r d6894723d9bf -r e28c752d826f main.cpp
--- a/main.cpp	Wed Nov 02 09:42:14 2016 +0000
+++ b/main.cpp	Wed Nov 02 09:50:13 2016 +0000
@@ -296,7 +296,7 @@
 switch_function.attach(&SwitchN,1.0);                   //switch is every second available
 ticker_calibration_biceps.attach (&calibration_biceps,2.0);   //to call calibration biceps, stop everything else
 ticker_calibration_triceps.attach(&calibration_triceps,2.0);  //to call calibration triceps, stop everything else
-encoder_ticker.attach(&encoder_working,0.0001);
+
 
   if (motorswitch%2==0) {
         pc.printf("If you contract the right arm, the robot will go right \r\n");
@@ -325,37 +325,38 @@
     //motor control with muscles.
     if (buttontest==0)                           // als s ingedrukt wordt gebeurd het volgende
     {
-         if (motorswitch%2==0 && rev_counts_motor1>-3.4)                     // als s ingedrukt wordt en het getal is even gebeurd het onderstaande
+         if (motorswitch%2==0 && rev_counts_motor1<3.4)                     // als s ingedrukt wordt en het getal is even gebeurd het onderstaande
          { 
            direction_motor1 = ccw; //right
            pwm_motor1 = 0.18; 
            pc.printf("ccw m1\r\n");
+           encoder_working();
            
          } 
          
-         else if (motorswitch%2!=0 && rev_counts_motor2>-10.0)                        // als s is ingedrukt maar het getal is niet even (dus oneven) gebeurdt het onderstaande
+         else if (motorswitch%2!=0 && rev_counts_motor2<10.0)                        // als s is ingedrukt maar het getal is niet even (dus oneven) gebeurdt het onderstaande
          {
            direction_motor2 = ccw;  //down
            pwm_motor2 = 1;
+           encoder_working();
           
          }      
               
     }
     else if (buttontest2==0)                     
     {
-         if (motorswitch%2==0 && rev_counts_motor1<3.4)    //restriction
+         if (motorswitch%2==0 && rev_counts_motor1>-3.4)    //restriction
          {
            direction_motor1 = cw; //left
-           pwm_motor1 = 0.5;
-           pc.printf("cw 1 aan\r\n");
-           
-    
-           
+           pwm_motor1 = 0.18;
+           encoder_working();
+                                    
         } 
-         else if(motorswitch%2!=0 && rev_counts_motor2<19.0)                          // als d is ingedrukt maar het getal is niet even (dus oneven) gebeurt het onderstaande
+         else if(motorswitch%2!=0 && rev_counts_motor2>-19.0)                          // als d is ingedrukt maar het getal is niet even (dus oneven) gebeurt het onderstaande
          {
            direction_motor2 = cw;
            pwm_motor2 = 1;
+           encoder_working();
               
          }  
     }   
@@ -363,8 +364,11 @@
        
     pwm_motor2=0;
     pwm_motor1=0;
+    encoder_working();
              
        }              
     pc.printf("rev_counts_motor1= %f \r\n",rev_counts_motor1);          
+    pc.printf("rev_counts_motor2= %f \r\n",rev_counts_motor2);          
+
 }
  }       
\ No newline at end of file