Scaled IR readings by 10^5 so also changed thresholds. Implemented and tested LED multiplexing Working on a new turning scheme involving IR readings

Dependencies:   QEI RemoteIR mbed

Fork of encoder_v2 by Micromouse 18

Committer:
kensterino
Date:
Wed Nov 08 01:17:49 2017 +0000
Revision:
0:b9e03a03e580
Child:
1:1b18e69bf50f
encoder

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kensterino 0:b9e03a03e580 1 #include "mbed.h"
kensterino 0:b9e03a03e580 2 #include "QEI.h"
kensterino 0:b9e03a03e580 3 Serial pc (PA_2, PA_3); //serial comm enabled on pins pa_2 and pa_3
kensterino 0:b9e03a03e580 4 QEI encoder_Right(PB_3, PA_15, NC, 360, QEI::X4_ENCODING);
kensterino 0:b9e03a03e580 5 QEI encoder_Left(PA_1, PC_4, NC, 360, QEI::X4_ENCODING); //forward increases pulses
kensterino 0:b9e03a03e580 6
kensterino 0:b9e03a03e580 7 //QEI functions
kensterino 0:b9e03a03e580 8 /*
kensterino 0:b9e03a03e580 9 void reset (void)
kensterino 0:b9e03a03e580 10 Reset the encoder.
kensterino 0:b9e03a03e580 11 int getCurrentState (void)
kensterino 0:b9e03a03e580 12 Read the state of the encoder.
kensterino 0:b9e03a03e580 13 int getPulses (void)
kensterino 0:b9e03a03e580 14 Read the number of pulses recorded by the encoder.
kensterino 0:b9e03a03e580 15 int getRevolutions (void)
kensterino 0:b9e03a03e580 16 Read the number of revolutions recorded by the encoder on the index channel.
kensterino 0:b9e03a03e580 17 */
kensterino 0:b9e03a03e580 18
kensterino 0:b9e03a03e580 19 int main()
kensterino 0:b9e03a03e580 20 {
kensterino 0:b9e03a03e580 21
kensterino 0:b9e03a03e580 22 while(1) {
kensterino 0:b9e03a03e580 23 wait(0.1);
kensterino 0:b9e03a03e580 24 pc.printf("Pulses is: %i\n", encoder_Right.getPulses());
kensterino 0:b9e03a03e580 25 //pc.printf("Pulses is: %i\n", encoder_Left.getPulses());
kensterino 0:b9e03a03e580 26 }
kensterino 0:b9e03a03e580 27
kensterino 0:b9e03a03e580 28 }