
Low end EMG measuring
Revision 0:498fc20f5c30, committed 2018-09-27
- Comitter:
- CasperK
- Date:
- Thu Sep 27 13:07:35 2018 +0000
- Commit message:
- Low end EMG measuring of 2 muscles
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HIDScope.lib Thu Sep 27 13:07:35 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tomlankhorst/code/HIDScope/#eade4ec5282b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 27 13:07:35 2018 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" +#include "HIDScope.h" + +//Define objects +AnalogIn emg0( A0 ); +AnalogIn emg1( A1 ); + +Ticker sample_timer; +HIDScope scope( 4 ); +DigitalOut led(LED1); + +/** Sample function + * this function samples the emg and sends it to HIDScope + **/ +void sample() +{ + /* Set the sampled emg values in channel 0 (the first channel) and 1 (the second channel) in the 'HIDScope' instance named 'scope' */ + scope.set(0, emg0.read() ); + scope.set(1, emg1.read() ); + + scope.send(); + /* To indicate that the function is working, the LED is toggled */ + led = !led; +} + +int main() +{ + /**Attach the 'sample' function to the timer 'sample_timer'. + * this ensures that 'sample' is executed every... 0.002 seconds = 500 Hz + */ + sample_timer.attach(&sample, 0.002); + + /*empty loop, sample() is executed periodically*/ + while(1) {} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 27 13:07:35 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/aae6fcc7d9bb \ No newline at end of file