Makoto Kobayashi
/
test_encoder
encoder test
Diff: main.cpp
- Revision:
- 0:cc481a1f6157
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 20 11:12:07 2014 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include "QEI.h" + +#define PULSE_PER_REVOLUTION 200 + +Serial pc(USBTX, USBRX); +QEI motor(p26, p26, NC, PULSE_PER_REVOLUTION, QEI::X2_ENCODING); + +int main(){ + pc.baud(57600); + motor.reset(); + + while(1) { + pc.printf("%d\n",motor.getPulses()); + motor.reset(); + wait(0.5); + } +} \ No newline at end of file