![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
EMG signalen uitlezen met filters
Dependencies: HIDScope biquadFilter mbed
main.cpp
- Committer:
- laurette
- Date:
- 2016-10-27
- Revision:
- 0:5759df060d75
- Child:
- 1:0d62559f43af
File content as of revision 0:5759df060d75:
#include "mbed.h" #include "HIDScope.h" //Define objects AnalogIn emg0( A0 ); AnalogIn emg1( A1 ); AnalogIn emg2( A2 ); Ticker sample_timer; HIDScope scope( 3 ); // Instantize a 3-channel HIDScope object DigitalOut led(LED1); // Instantize the timer for sending data to the PC /** Sample function * this function samples the emg and sends it to HIDScope **/ void sample() { /* Set the sampled emg values in channel 0/1/2 (the first/second/third channel) in the 'HIDScope' instance named 'scope' */ scope.set(0, emg0.read() ); scope.set(1, emg1.read() ); scope.set(2, emg2.read() ); /* Finally, send all channels to the PC at once */ 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.001 seconds = 1000 Hz */ sample_timer.attach(&sample, 0.001); /*empty loop, sample() is executed periodically*/ while(1) {} }