![](/media/cache/profiles/94aef38441efa3380a3bed3faf1f9d5d.50x50_q85.jpg)
main.cpp
- Committer:
- nucho
- Date:
- 2010-08-17
- Revision:
- 0:f04f71978041
- Child:
- 1:18439e758b09
File content as of revision 0:f04f71978041:
#include "QEI.h" #include "TextLCD.h" #define ROTATE_PER_REVOLUTIONS 24 TextLCD lcd(p5, p6, p11, p12, p13, p14); // rs, e, d0-d3 Serial pc(USBTX, USBRX); //Use X4 encoding. QEI wheel(p29, p30, NC, ROTATE_PER_REVOLUTIONS, QEI::X4_ENCODING); //Use X2 encoding by default. //QEI wheel (p29, p30, NC, 624); int main() { while(1){ wait(0.1); lcd.printf("Pulses: %07d\n", wheel.getPulses()); lcd.printf("Rotate: %04.3f\n", (double)wheel.getPulses()/(ROTATE_PER_REVOLUTIONS*4)); } }