Colour sensors calibrated

Dependencies:   mbed-rtos mbed Servo QEI

Fork of ICRSEurobot13 by Thomas Branch

Committer:
xiaxia686
Date:
Fri Apr 12 20:59:18 2013 +0000
Revision:
46:adcd57a5e402
Parent:
20:70d651156779
Colours Sensors fixed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
twighk 0:200635fa1b08 1
madcowswe 20:70d651156779 2 #ifndef ENCODER_H
madcowswe 20:70d651156779 3 #define ENCODER_H
twighk 0:200635fa1b08 4
twighk 0:200635fa1b08 5 #include "QEI.h"
twighk 0:200635fa1b08 6 #include "mbed.h"
madcowswe 20:70d651156779 7 #include "globals.h"
twighk 0:200635fa1b08 8
twighk 0:200635fa1b08 9 class Encoder{
twighk 0:200635fa1b08 10 private:
twighk 0:200635fa1b08 11 DigitalIn green, yellow;
twighk 0:200635fa1b08 12 QEI wheel;
twighk 0:200635fa1b08 13
twighk 0:200635fa1b08 14 public:
twighk 0:200635fa1b08 15 Encoder(PinName pGreen, PinName pYellow)
twighk 0:200635fa1b08 16 : green(pGreen)
twighk 0:200635fa1b08 17 , yellow(pYellow)
madcowswe 5:56a5fdd373c9 18 , wheel(pGreen,pYellow, NC, 0, QEI::X4_ENCODING)
twighk 0:200635fa1b08 19 {
twighk 0:200635fa1b08 20 green.mode(PullUp);
twighk 0:200635fa1b08 21 yellow.mode(PullUp);
twighk 0:200635fa1b08 22 }
twighk 0:200635fa1b08 23
madcowswe 20:70d651156779 24 int getTicks(void){
twighk 0:200635fa1b08 25 return wheel.getPulses();
twighk 0:200635fa1b08 26 }
twighk 0:200635fa1b08 27
twighk 0:200635fa1b08 28 void reset (void){
twighk 0:200635fa1b08 29 return wheel.reset();
twighk 0:200635fa1b08 30 }
twighk 0:200635fa1b08 31 };
madcowswe 20:70d651156779 32
madcowswe 20:70d651156779 33 #ifdef ENABLE_GLOBAL_ENCODERS
madcowswe 20:70d651156779 34 extern Encoder right_encoder;
madcowswe 20:70d651156779 35 extern Encoder left_encoder;
madcowswe 20:70d651156779 36 #endif
madcowswe 20:70d651156779 37
madcowswe 20:70d651156779 38 #endif //ENCODER_H