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 biquadFilter mbed
Fork of a_check_emg_filtered_without_cal by
Diff: main.cpp
- Revision:
- 2:025d9065b25f
- Parent:
- 1:30d46f7e5150
- Child:
- 3:79b95226a608
--- a/main.cpp Fri Oct 21 12:17:41 2016 +0000
+++ b/main.cpp Fri Oct 21 12:41:47 2016 +0000
@@ -1,26 +1,32 @@
//libraries
#include "mbed.h"
#include "HIDScope.h"
-#include "biquadFilter.h"
+#include "biquadFilter.h"
+#include "MODSERIAL.h"
//Define objects
AnalogIn emg0( A0 ); //analog in to get EMG in to c++
Ticker sample_timer; //ticker
HIDScope scope( 2); //open 3 channels in hidscope
DigitalOut led(LED_GREEN);
+MODSERIAL pc(USBTX,USBRX); // connection with pc
+
//define variables
double emg_0_value;
+biquadFilter filter(-1.1430, 0.4128, 0.6389, -1.2779, 0.6389); //initialize filter
void filter(){
emg_0_value=emg0.read(); //read the emg value from the elektrodes
led=!led;
-
+ emg_filter=filter.step(emg_0_value)
//send signals to scope
scope.set(0, emg_0_value ); //set emg signal to scope in channel 1
- scope.set(1, emg_0_value );
+ scope.set(1, emg_filter );
scope.send(); //send all the signals to the scope
+
+ pc.printf("emg raw: %f, emg filter %f \r\n",emg_o_value,emg_filter);
}
//program
@@ -28,7 +34,7 @@
int main()
{
sample_timer.attach(&filter, 0.001); //continously execute the EMG reader and filter, it ensures that filter and sampling is executed every 1/frequency seconds
-
+pc.baud(115200); //connection with pc at 115200 rate
//endless loop
while(1)
