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

Revision:
0:674026fdd982
Child:
1:75f61e111ed0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 18 12:36:54 2015 +0000
@@ -0,0 +1,33 @@
+#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);
+     //       }
+    }
+}
\ No newline at end of file