Search Code
About QEI_HelloWorld

First published 03 Aug 2010, with 2 revisions since.
Last update: 11 Aug 2010.
View history

Last change message: Added an example of creating a QEI with X4 encoding, as opposed to the default X2 encoding option.

Import this program

QEI_HelloWorld

Published 11 Aug 2010, by   user Aaron Berk   tag Encoder, QEI, quadrature
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 }