Eindversie. LU: 07-11-13.

Dependencies:   MODSERIAL mbed Encoder

Files at this revision

API Documentation at this revision

Comitter:
Socrates
Date:
Tue Oct 15 14:08:58 2013 +0000
Child:
1:34202d107458
Commit message:
werkt niet

Changed in this revision

MODSERIAL.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MODSERIAL.lib	Tue Oct 15 14:08:58 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MODSERIAL/#b04ce87dc424
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 15 14:08:58 2013 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "MODSERIAL.h"
+
+AnalogIn emg(PTB0);
+MODSERIAL pc(USBTX,USBRX);
+
+volatile bool looptimerflag;
+
+void setlooptimerflag(void)
+{
+    looptimerflag = true;
+}
+
+
+int main()
+{
+    Ticker looptimer;
+    looptimer.attach(setlooptimerflag,0.001);
+    float x,y,y1,x1,z1,yabs,z,yabs1;
+    //const float ts=0.001;
+    x1=0;
+    y1=0;
+    z1=0;
+    yabs1=0;
+    pc.baud(115200);
+
+    while(1) {
+        while(looptimerflag != true);
+        looptimerflag = false;
+        x=emg.read();
+        y=(y1/1.001-(0.9969/1.001)*x1+(0.9978565/1.001)*x);
+        yabs=abs(y);
+        z=(z1/1.001-(0.006244/1.001)*yabs1+(0.006238/1.001)*yabs);
+        pc.printf("%f\n\r",z);
+        x1=x;
+        y1=y;
+        z1=z;
+        yabs1=yabs;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 15 14:08:58 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file