firsrt

Dependencies:   QEI mbed

Files at this revision

API Documentation at this revision

Comitter:
NiNiHtayLwin
Date:
Sun Jul 22 09:44:27 2018 +0000
Commit message:
first order

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:44:27 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:44:27 2018 +0000
@@ -0,0 +1,31 @@
+#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   PI             = 3.1416;
+double   fc             = 0.5;
+double   tau            = 1/(2*PI*fc);
+double   now_x          = 0.0;
+double   now_y          = 0.0;
+double   prv_y          = 0.0;
+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);
+        now_y     = ( samp_time * now_x + (tau * prv_y) ) / ( samp_time + tau);
+    
+        pc.printf("   %F      %F     %F      %F\r", now_time, samp_time, now_x, now_y);
+        printf("\n\r");
+        prv_time = now_time;
+        prv_y    = now_y; 
+        
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jul 22 09:44:27 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file