Remco Dasselaar / Mbed 2 deprecated TotalControlEmg2

Dependencies:   HIDScope MODSERIAL QEI TextLCD mbed

Fork of TotalControlEmg2 by Remco Dasselaar

Revision:
17:cfe44346645c
Parent:
16:8f175d2a472f
Child:
18:eec0880fcded
diff -r 8f175d2a472f -r cfe44346645c main.cpp
--- a/main.cpp	Fri Oct 09 09:57:09 2015 +0000
+++ b/main.cpp	Fri Oct 09 11:27:58 2015 +0000
@@ -1,24 +1,26 @@
 #include "mbed.h"
 #include "HIDScope.h"
 #include "Filterdesigns.h"
-#inlcude "Kalibratie.h"
-//#include "MODSERIAL.h" //bugfix
+#include "Kalibratie.h"
+#include "MODSERIAL.h" //bugfix
 
 AnalogIn    emg(A0); //Analog input van emg kabels
 HIDScope    scope(2); //2 scopes
 Ticker      EMGticker;
-//MODSERIAL   pc(USBTX, USBRX); //bugfix
+MODSERIAL   pc(USBTX, USBRX); //bugfix
+DigitalOut  LedBlue(LED3);
 
 //Sample frequentie
 double Fs = 500; //Hz
 double t = 1/ Fs; // voor EMGticker
 
-double y = 0;
+bool readymax = 0;
+bool readymin = 0;
 
 void EMGfilter(){
     //uitlezen emg signaal
     double u = emg.read();
-    Filterdesigns(u,y);
+    double y = Filterdesigns(u);
 //    pc.printf("%f \n",y); //bugfix
     // Plotten in HIDscope
     scope.set(0,u); //ongefilterde waarde naar scope 1
@@ -28,7 +30,17 @@
     
 
 int main(){
-    EMGticker.attach(&EMGfilter, t); //500Hz
-    while(1){}
+    LedBlue = 1;
+    Init();
+    double ymax = KalibratieMax(readymax);
+    double ymin = KalibratieMin(readymin);
+    
+    pc.printf("ymax = %f en ymin = %f \n",ymax, ymin); //bugfix
+    
+    while(readymax == 1 && readymin == 1){
+        LedBlue = 0;
+        EMGticker.attach(&EMGfilter, t); //500H
+            while(1){}
+        }
     }
     
\ No newline at end of file