This is some awesome robot code
Dependencies: mbed-rtos mbed QEI
Fork of ICRSEurobot13 by
Sensors/Encoders/Encoder.h@1:8119211eae14, 2013-03-29 (annotated)
- Committer:
- twighk
- Date:
- Fri Mar 29 16:28:56 2013 +0000
- Revision:
- 1:8119211eae14
- Parent:
- Sensors/Encoder/Encoder.h@0:200635fa1b08
- Child:
- 5:56a5fdd373c9
Arms / servos
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
twighk | 0:200635fa1b08 | 1 | |
twighk | 0:200635fa1b08 | 2 | // Eurobot13 Encoder.cpp |
twighk | 0:200635fa1b08 | 3 | |
twighk | 0:200635fa1b08 | 4 | #include "QEI.h" |
twighk | 0:200635fa1b08 | 5 | #include "mbed.h" |
twighk | 0:200635fa1b08 | 6 | |
twighk | 0:200635fa1b08 | 7 | class Encoder{ |
twighk | 0:200635fa1b08 | 8 | private: |
twighk | 0:200635fa1b08 | 9 | DigitalIn green, yellow; |
twighk | 0:200635fa1b08 | 10 | QEI wheel; |
twighk | 0:200635fa1b08 | 11 | |
twighk | 0:200635fa1b08 | 12 | public: |
twighk | 0:200635fa1b08 | 13 | Encoder(PinName pGreen, PinName pYellow) |
twighk | 0:200635fa1b08 | 14 | : green(pGreen) |
twighk | 0:200635fa1b08 | 15 | , yellow(pYellow) |
twighk | 0:200635fa1b08 | 16 | , wheel(pGreen,pYellow, NC, 624) |
twighk | 0:200635fa1b08 | 17 | { |
twighk | 0:200635fa1b08 | 18 | green.mode(PullUp); |
twighk | 0:200635fa1b08 | 19 | yellow.mode(PullUp); |
twighk | 0:200635fa1b08 | 20 | } |
twighk | 0:200635fa1b08 | 21 | |
twighk | 0:200635fa1b08 | 22 | int getPoint(void){ |
twighk | 0:200635fa1b08 | 23 | return wheel.getPulses(); |
twighk | 0:200635fa1b08 | 24 | } |
twighk | 0:200635fa1b08 | 25 | |
twighk | 0:200635fa1b08 | 26 | void reset (void){ |
twighk | 0:200635fa1b08 | 27 | return wheel.reset(); |
twighk | 0:200635fa1b08 | 28 | } |
twighk | 0:200635fa1b08 | 29 | }; |