Emg filter function script for a uni project. Made by Teun van der Molen

Dependencies:   HIDScope MODSERIAL mbed

Fork of frdm_EMG by Teun van der Molen

main.cpp

Committer:
teunman
Date:
2015-09-18
Revision:
0:674026fdd982
Child:
1:75f61e111ed0

File content as of revision 0:674026fdd982:

#include "mbed.h"
#include "HIDScope.h"
#include "math.h" 
// Define the HIDScope and Ticker object
HIDScope    scope(1);
Ticker      scopeTimer;
 
// Read the analog input
AnalogIn    an_in(A0);
AnalogOut   an_out(DAC0_OUT); 
// The data read and send function
void scopeSend()
{
    scope.set(0,an_in.read());
    scope.send();
}
 
int main()
{
    // Attach the data read and send function at 100 Hz
    scopeTimer.attach_us(&scopeSend, 1e4);   
     float i = 1;
    while(1) {
            // sinewave output
      //  for (int i = 1; i < 360; i++) {
           
           float func = 0.5 + 0.5*sin(i); 
            i = i+0.01;
            an_out = func;
            wait(0.001);
     //       }
    }
}