working version but stripped of most unnecessary code like print statements

Dependencies:   HIDScope MODSERIAL biquadFilter mbed FastPWM QEI

Files at this revision

API Documentation at this revision

Comitter:
vsluiter
Date:
Thu Oct 03 13:47:49 2013 +0000
Parent:
5:4dacb7b72109
Child:
7:3396c3e33928
Commit message:
Added some measures to prevent overflow; Data rate is still too high, though

Changed in this revision

MODSERIAL.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MODSERIAL.lib	Thu Oct 03 13:47:49 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MODSERIAL/#b04ce87dc424
--- 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());
     */