Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "QEI.h" 00002 #include "TextLCD.h" 00003 00004 00005 TextLCD lcd(p5, p6, p11, p12, p13, p14); // rs, e, d0-d3 00006 Serial pc(USBTX, USBRX); 00007 00008 #define ROTATE_PER_REVOLUTIONS 24 00009 //Use X4 encoding. 00010 QEI wheel(p30, p29, NC, 24, QEI::X4_ENCODING); 00011 //Use X2 encoding by default. 00012 //QEI wheel (p29, p30, NC, 624); 00013 00014 int main() { 00015 while(1){ 00016 wait(0.1); 00017 lcd.printf("Pulses: %07d\n", wheel.getPulses()); 00018 lcd.printf("Rotate: %04.3f\n", (double)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4)); 00019 } 00020 }
Generated on Wed Jul 27 2022 13:11:42 by
1.7.2