Quadrature encoder interface example.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "QEI.h"
00002 
00003 Serial pc(USBTX, USBRX);
00004 //Use X4 encoding.
00005 //QEI wheel(p29, p30, NC, 624, QEI::X4_ENCODING);
00006 //Use X2 encoding by default.
00007 QEI wheel (p29, p30, NC, 624);
00008 
00009 int main() {
00010 
00011     while(1){
00012         wait(0.1);
00013         pc.printf("Pulses is: %i\n", wheel.getPulses());
00014     }
00015 
00016 }