QEI calculates distance of rotation if given diameter

Dependencies:   QEI mbed

Fork of QEI_HelloWorld by Aaron Berk

Committer:
jvfausto
Date:
Fri Aug 03 20:29:28 2018 +0000
Revision:
2:f06a9b5fbeb4
Parent:
1:30696e4d196b
W/ distance

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aberk 0:bcff39fac858 1 #include "QEI.h"
aberk 0:bcff39fac858 2
aberk 0:bcff39fac858 3 Serial pc(USBTX, USBRX);
aberk 1:30696e4d196b 4 //Use X4 encoding.
aberk 1:30696e4d196b 5 //QEI wheel(p29, p30, NC, 624, QEI::X4_ENCODING);
aberk 1:30696e4d196b 6 //Use X2 encoding by default.
jvfausto 2:f06a9b5fbeb4 7 QEI wheel (D0, D1, NC, 1200);
aberk 0:bcff39fac858 8
aberk 0:bcff39fac858 9 int main() {
aberk 0:bcff39fac858 10
aberk 0:bcff39fac858 11 while(1){
aberk 1:30696e4d196b 12 wait(0.1);
jvfausto 2:f06a9b5fbeb4 13 pc.printf("Distance is: %f \r\n", wheel.getDistance(31.75));
jvfausto 2:f06a9b5fbeb4 14
aberk 0:bcff39fac858 15 }
aberk 0:bcff39fac858 16
aberk 0:bcff39fac858 17 }