Measure EMG, publish on HID Scope

Dependencies:   HIDScope mbed mbed-dsp

Fork of EMG by First Last

Revision:
6:80c13d99aa55
Parent:
5:4dacb7b72109
Child:
7:3396c3e33928
diff -r 4dacb7b72109 -r 80c13d99aa55 main.cpp
--- a/main.cpp	Wed Oct 02 09:45:01 2013 +0000
+++ b/main.cpp	Thu Oct 03 13:47:49 2013 +0000
@@ -1,10 +1,11 @@
 #include "mbed.h"
+#include "MODSERIAL.h"
 
 //Define objects
 AnalogIn    emg0(PTB0); //Analog input
 PwmOut      red(LED_RED); //PWM output
 Ticker timer;
-Serial pc(USBTX,USBRX);
+MODSERIAL pc(USBTX,USBRX,64,1024);
 
 /** Looper function
 * functions used for Ticker and Timeout should be of type void <name>(void)
@@ -26,7 +27,8 @@
     /*put raw emg value both in red and in emg_value*/
     red = emg_value = emg0.read();
     /*send value to PC. use 6 digits after decimal sign*/
-    pc.printf("%.6f\n",emg_value);
+    if(pc.rxBufferGetSize(0)-pc.rxBufferGetCount() > 30)
+        pc.printf("%.6f\n",emg_value);
     /**When not using the LED, the above could also have been done this way:
     * pc.printf("%.6\n", emg0.read());
     */