Myo Thant Sin Aung / Mbed 2 deprecated 2ndOfilter_DNNHL_e01

Dependencies:   QEI mbed

Fork of 2ndOfilter by velo_filter

Files at this revision

API Documentation at this revision

Comitter:
NiNiHtayLwin
Date:
Sun Jul 22 09:41:09 2018 +0000
Child:
1:57f0db59db9f
Commit message:
2ndOFil

Changed in this revision

QEI.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/QEI.lib	Sun Jul 22 09:41:09 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/aberk/code/QEI/#5c2ad81551aa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Jul 22 09:41:09 2018 +0000
@@ -0,0 +1,39 @@
+#include "QEI.h"
+#include "mbed.h"
+Serial pc(USBTX, USBRX);
+double   prv_time       = 0.0;
+double   now_time       = 0.0;
+double   samp_time      = 0.0;
+double   now_x          = 0.0;
+double   now_d          = 0.0;
+double   prv_d          = 0.0;
+double   pr2v_d         = 0.0;
+double   a              = 0.0;
+double   b              = 0.0;
+double   c              = 0.0;
+double   PI             = 3.1416;
+double   fc             = 0.05/(2*PI);
+double   C              =(2*PI*fc)*(2*PI*fc) ;
+double   B              = sqrt(2*C);
+int main()
+{
+    Timer myTime;
+    myTime.reset();
+    myTime.start();
+    pc.baud(57600);
+    while(1) {
+        now_time  = myTime.read_ms()/1000.0;
+        samp_time = now_time - prv_time;
+        now_x     = sin(2*PI*0.5*now_time) + 0.5*sin(2*PI*100*now_time);
+        a         = ((samp_time*samp_time)*C)*now_x;
+        b         = (2+(samp_time*B))*prv_d;
+        c         = pr2v_d;
+        now_d     = (a+b-c)/(((samp_time*samp_time)*C)+(samp_time*B)+1);
+    
+        pc.printf("   %F      %F     %F      %F\r", now_time, samp_time, now_x, now_d);
+        printf("\n\r");
+        prv_time = now_time;
+        prv_d    = now_d;
+        pr2v_d   = prv_d;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jul 22 09:41:09 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file