エンコーダ用プログラム

Dependencies:   QEI mbed

Files at this revision

API Documentation at this revision

Comitter:
tomirobo
Date:
Wed Sep 14 15:36:20 2016 +0000
Commit message:
test

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
diff -r 000000000000 -r e543236c8336 QEI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QEI.lib	Wed Sep 14 15:36:20 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/aberk/code/QEI/#5c2ad81551aa
diff -r 000000000000 -r e543236c8336 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 14 15:36:20 2016 +0000
@@ -0,0 +1,17 @@
+#include "QEI.h"
+
+Serial pc(USBTX, USBRX);
+
+#define ROTATE_PER_REVOLUTIONS  500
+//Use X4 encoding.
+QEI wheel(dp17, dp18, dp26, ROTATE_PER_REVOLUTIONS, QEI::X4_ENCODING);
+//Use X2 encoding by default.
+//QEI wheel (p30, p29, NC, 624);
+
+int main() {
+    while(1){
+        wait(0.1);
+        //pc.printf("Pulses: %07d\n", wheel.getPulses());
+        pc.printf("Rotate: %04.3f\r\n", (double)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4));
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r e543236c8336 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 14 15:36:20 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/2e9cc70d1897
\ No newline at end of file