groep 16 / Mbed 2 deprecated EMG

Dependencies:   mbed HIDScope BiQuad4th_order biquadFilter MODSERIAL

Files at this revision

API Documentation at this revision

Comitter:
lucvandijk
Date:
Tue Oct 29 12:11:23 2019 +0000
Parent:
21:2c26b74a3e48
Commit message:
werkt prima, ipv de led in de main kan de motor komen;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Oct 29 09:51:59 2019 +0000
+++ b/main.cpp	Tue Oct 29 12:11:23 2019 +0000
@@ -25,7 +25,7 @@
 volatile double emg2_filtered;      //measured value of the second emg
 volatile double emg1_max ;           // calibrated value of first emg
 volatile double emg2_max ;
-volatile double emg1_cal = 0.1;
+volatile double emg1_cal = 0.8;
  
  // Read EMG
 //void EMGread()
@@ -60,10 +60,13 @@
         if(SW3==0){
             EMGcalibration();
             }
-        if(emg1_filtered >= 0.8){
-            led = !led;
-        }
-        }
+            
+    led = 1; 
+        
+    while(emg1_filtered >= 0.9*emg1_cal){
+            led = 0;
+    }
+    }
 }