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:
- 0:34c739fcc3e0
- Child:
- 1:30d46f7e5150
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Oct 21 12:11:44 2016 +0000
@@ -0,0 +1,37 @@
+//libraries
+#include "mbed.h"
+#include "HIDScope.h"
+#include "biquadFilter.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);
+
+//define variables
+double emg_0_value;
+
+
+void filter(){
+ emg_0_value=emg0.read(); //read the emg value from the elektrodes
+ led=!led;
+
+ //send signals to scope
+ scope.set(0, emg0.read() ); //set emg signal to scope in channel 1
+ scope.set(1, emg_0_value );
+ scope.send(); //send all the signals to the scope
+ }
+
+//program
+
+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
+
+//endless loop
+
+ while(1)
+ {}
+
+}
\ No newline at end of file
