Micromouse 18
/
encoder
encoder
Diff: main.cpp
- Revision:
- 0:b9e03a03e580
- Child:
- 1:1b18e69bf50f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Nov 08 01:17:49 2017 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "QEI.h" +Serial pc (PA_2, PA_3); //serial comm enabled on pins pa_2 and pa_3 +QEI encoder_Right(PB_3, PA_15, NC, 360, QEI::X4_ENCODING); +QEI encoder_Left(PA_1, PC_4, NC, 360, QEI::X4_ENCODING); //forward increases pulses + +//QEI functions +/* +void reset (void) + Reset the encoder. +int getCurrentState (void) + Read the state of the encoder. +int getPulses (void) + Read the number of pulses recorded by the encoder. +int getRevolutions (void) + Read the number of revolutions recorded by the encoder on the index channel. +*/ + +int main() +{ + + while(1) { + wait(0.1); + pc.printf("Pulses is: %i\n", encoder_Right.getPulses()); + //pc.printf("Pulses is: %i\n", encoder_Left.getPulses()); + } + +} \ No newline at end of file