Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HIDScope MODSERIAL mbed-dsp mbed
Fork of emg_filter2 by
Diff: main.cpp
- Revision:
- 6:80c13d99aa55
- Parent:
- 5:4dacb7b72109
- Child:
- 7:3396c3e33928
--- 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());
*/
