QEI calculates distance of rotation if given diameter
Fork of QEI_HelloWorld by
Diff: main.cpp
- Revision:
- 2:f06a9b5fbeb4
- Parent:
- 1:30696e4d196b
--- a/main.cpp Wed Aug 11 09:15:10 2010 +0000 +++ b/main.cpp Fri Aug 03 20:29:28 2018 +0000 @@ -4,13 +4,14 @@ //Use X4 encoding. //QEI wheel(p29, p30, NC, 624, QEI::X4_ENCODING); //Use X2 encoding by default. -QEI wheel (p29, p30, NC, 624); +QEI wheel (D0, D1, NC, 1200); int main() { while(1){ wait(0.1); - pc.printf("Pulses is: %i\n", wheel.getPulses()); + pc.printf("Distance is: %f \r\n", wheel.getDistance(31.75)); + } }