Overzetten

Dependencies:   HIDScope MODSERIAL mbed

Revision:
8:81f2c8ae4427
Parent:
7:d57eba2aed38
Child:
9:836d6ac23481
--- a/main.cpp	Mon Oct 08 13:18:17 2018 +0000
+++ b/main.cpp	Fri Oct 12 08:53:12 2018 +0000
@@ -18,6 +18,10 @@
 HIDScope    scope( 2 );
 DigitalOut  led(LED1);
 
+Ticker      Motor_Ticker1;
+Ticker      Motor_Ticker2;
+Ticker      EMG_Read_Ticker;
+
 volatile float Bicep_Right = 0.0;
 
 void EMG_Read()
@@ -62,7 +66,7 @@
             PwmPin2 = fabs(0.0);  
         }
         
-        else if (Bicep_Right > 0.7f)
+        else if (Bicep_Right > 0.6f)
         {
             float u = 0.8f; //determine useful value, this is not final
             DirectionPin1 = u > 0.0f; //either true or false
@@ -117,9 +121,10 @@
     sample_timer.attach(&sample, 0.002);
     PwmPin1.period_us(120); //60 microseconds pwm period, 16.7 kHz 
 
+    EMG_Read_Ticker.attach(&EMG_Read, 0.002);
+
     while(true)
     {
-        EMG_Read();
         Turn_Motor1();
         Turn_Motor2();   
         pc.printf("%f     ", Bicep_Right);