Gustav Aditya Permana
/
coba_QEI
hanya buat kamu B
Diff: main.cpp
- Revision:
- 0:bb49b8e23b5d
- Child:
- 1:d4e4fc0ee666
diff -r 000000000000 -r bb49b8e23b5d main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 05 09:56:54 2016 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "QEI.h" + +QEI encoder( PA_3, PA_2, NC, 360, QEI::X4_ENCODING); + +Serial pc(USBTX,USBRX); + +int pulse; +int rev; + +int main() +{ + pc.baud(115200); + + while(1) + { + pulse = encoder.getPulses(); + rev = encoder.getRevolutions(); + pc.printf("%d Pulses\t\t%d Putaran\n", pulse, rev); + } +} \ No newline at end of file