QEI calculates distance of rotation if given diameter

Dependencies:   QEI mbed

Fork of QEI_HelloWorld by Aaron Berk

main.cpp

Committer:
jvfausto
Date:
2018-08-03
Revision:
2:f06a9b5fbeb4
Parent:
1:30696e4d196b

File content as of revision 2:f06a9b5fbeb4:

#include "QEI.h"

Serial pc(USBTX, USBRX);
//Use X4 encoding.
//QEI wheel(p29, p30, NC, 624, QEI::X4_ENCODING);
//Use X2 encoding by default.
QEI wheel (D0, D1, NC, 1200);

int main() {

    while(1){
        wait(0.1);
        pc.printf("Distance is: %f \r\n", wheel.getDistance(31.75));

    }

}