Colour sensors calibrated
Dependencies: mbed-rtos mbed Servo QEI
Fork of ICRSEurobot13 by
Actuators/Servo/Servo.h@0:200635fa1b08, 2013-03-29 (annotated)
- Committer:
- twighk
- Date:
- Fri Mar 29 11:35:34 2013 +0000
- Revision:
- 0:200635fa1b08
Main motors and motor encoders
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
twighk | 0:200635fa1b08 | 1 | |
twighk | 0:200635fa1b08 | 2 | // Eurobot13 Servo.h |
twighk | 0:200635fa1b08 | 3 | |
twighk | 0:200635fa1b08 | 4 | #include "mbed.h" |
twighk | 0:200635fa1b08 | 5 | |
twighk | 0:200635fa1b08 | 6 | class Servo{ |
twighk | 0:200635fa1b08 | 7 | private: |
twighk | 0:200635fa1b08 | 8 | PwmOut PWM; |
twighk | 0:200635fa1b08 | 9 | |
twighk | 0:200635fa1b08 | 10 | public: |
twighk | 0:200635fa1b08 | 11 | Servo(PinName pin1) : PWM(pin1){ |
twighk | 0:200635fa1b08 | 12 | } |
twighk | 0:200635fa1b08 | 13 | |
twighk | 0:200635fa1b08 | 14 | void operator()(float in){ |
twighk | 0:200635fa1b08 | 15 | PWM = in; |
twighk | 0:200635fa1b08 | 16 | } |
twighk | 0:200635fa1b08 | 17 | |
twighk | 0:200635fa1b08 | 18 | void clockwise() { // full lock clockwise |
twighk | 0:200635fa1b08 | 19 | PWM = .135; |
twighk | 0:200635fa1b08 | 20 | } |
twighk | 0:200635fa1b08 | 21 | |
twighk | 0:200635fa1b08 | 22 | void anticlockwise() { // full lock anticlockwise |
twighk | 0:200635fa1b08 | 23 | PWM = .025; |
twighk | 0:200635fa1b08 | 24 | } |
twighk | 0:200635fa1b08 | 25 | |
twighk | 0:200635fa1b08 | 26 | void relax() { // servo applies no force |
twighk | 0:200635fa1b08 | 27 | PWM = 0; |
twighk | 0:200635fa1b08 | 28 | } |
twighk | 0:200635fa1b08 | 29 | |
twighk | 0:200635fa1b08 | 30 | }; |