Haruto Yano / Mbed 2 deprecated enc

Dependencies:   mbed QEI2

Files at this revision

API Documentation at this revision

Comitter:
firefly1250
Date:
Wed Nov 27 07:16:28 2019 +0000
Commit message:
initial commit

Changed in this revision

QEI2.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/QEI2.lib	Wed Nov 27 07:16:28 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/kikoaac/code/QEI2/#49fa8827718d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Nov 27 07:16:28 2019 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "QEI.h"
+
+const float M_PI = 3.14159265358979323846;
+
+Serial pc(USBTX, USBRX);
+Ticker flipper1;
+
+Timer timer;
+
+const int PPR = 1024;
+const int gear_ratio = 126; 
+//const float Sampling_time1 = 0.0005;
+const float Sampling_time1 = 0.01;
+
+QEI encs[6] = {
+     QEI(PD_12,  PA_15, NC, PPR, &timer),
+     QEI(PD_3,  PB_6, NC, PPR, &timer),
+     QEI(PB_10, PB_4, NC, PPR, &timer),//, QEI::X4_ENCODING),
+     QEI(PH_1,  PC_0, NC, PPR, &timer),
+     QEI(PG_2,  PC_7, NC, PPR, &timer),
+     QEI(PB_5,  PD_13, NC, PPR, &timer),
+};
+
+void flip1() {
+    for(int i=0;i<6;i++)
+        pc.printf("%f\n",encs[i].getAngle());
+    pc.printf("\n");
+}
+
+int main() {
+    pc.baud(115200);
+    flipper1.attach(&flip1, Sampling_time1);
+    
+    while(1){
+        //pc.printf("%f, %f, %f, %f, %f, %f\n", float(Pulses1), Angle1, Angular_velocity1, float(Pulses2), Angle2, Angular_velocity2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Nov 27 07:16:28 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file