Colour sensors calibrated

Dependencies:   mbed-rtos mbed Servo QEI

Fork of ICRSEurobot13 by Thomas Branch

Committer:
twighk
Date:
Wed Apr 03 17:54:53 2013 +0000
Revision:
4:1be0f6c6ceae
Parent:
2:45da48fab346
Child:
5:56a5fdd373c9
State on 3rd of april

Who changed what in which revision?

UserRevisionLine numberNew contents of line
twighk 1:8119211eae14 1
twighk 1:8119211eae14 2 // Eurobot13 WhiteArm.h
twighk 1:8119211eae14 3
twighk 1:8119211eae14 4 #include "mbed.h"
twighk 1:8119211eae14 5 #include "Servo.h"
twighk 2:45da48fab346 6 #include "Actuators/Actuator.h"
twighk 1:8119211eae14 7
twighk 2:45da48fab346 8 class Arm : public Servo, public Actuator
twighk 1:8119211eae14 9 {
twighk 1:8119211eae14 10 private:
twighk 1:8119211eae14 11 bool updirn;
twighk 1:8119211eae14 12
twighk 1:8119211eae14 13 public:
twighk 4:1be0f6c6ceae 14 Arm ( PinName yellowPWM
twighk 4:1be0f6c6ceae 15 , bool upflip = false
twighk 4:1be0f6c6ceae 16 , float range = 0.0005, float degrees = 45.0
twighk 4:1be0f6c6ceae 17 )
twighk 4:1be0f6c6ceae 18 : Servo(yellowPWM)
twighk 4:1be0f6c6ceae 19 {
twighk 1:8119211eae14 20 calibrate(range, degrees);
twighk 1:8119211eae14 21 updirn = upflip;
twighk 1:8119211eae14 22 }
twighk 1:8119211eae14 23
twighk 1:8119211eae14 24 void operator()(float in) {
twighk 1:8119211eae14 25 write(in);
twighk 1:8119211eae14 26 }
twighk 1:8119211eae14 27
twighk 1:8119211eae14 28 void clockwise() { // full lock clockwise
twighk 1:8119211eae14 29 write(updirn?1:0);
twighk 1:8119211eae14 30 }
twighk 1:8119211eae14 31
twighk 1:8119211eae14 32 void anticlockwise() { // full lock anticlockwise
twighk 1:8119211eae14 33 write(updirn?0:1);
twighk 1:8119211eae14 34 }
twighk 1:8119211eae14 35
twighk 2:45da48fab346 36 virtual void halt() { // servo applies no force
twighk 2:45da48fab346 37 DigitalOut myled(LED3);
twighk 2:45da48fab346 38 myled = 1;
twighk 1:8119211eae14 39 _pwm = 0;
twighk 1:8119211eae14 40 }
twighk 1:8119211eae14 41 };
twighk 1:8119211eae14 42
twighk 1:8119211eae14 43
twighk 1:8119211eae14 44 /*
twighk 1:8119211eae14 45 class Servo{
twighk 1:8119211eae14 46 private:
twighk 1:8119211eae14 47 PwmOut PWM;
twighk 1:8119211eae14 48
twighk 1:8119211eae14 49 public:
twighk 1:8119211eae14 50 Servo(PinName pin1) : PWM(pin1){
twighk 1:8119211eae14 51 }
twighk 1:8119211eae14 52
twighk 1:8119211eae14 53 void operator()(float in){
twighk 1:8119211eae14 54 PWM = in;
twighk 1:8119211eae14 55 }
twighk 1:8119211eae14 56
twighk 1:8119211eae14 57 void clockwise() { // full lock clockwise
twighk 1:8119211eae14 58 PWM = .135;
twighk 1:8119211eae14 59 }
twighk 1:8119211eae14 60
twighk 1:8119211eae14 61 void anticlockwise() { // full lock anticlockwise
twighk 1:8119211eae14 62 PWM = .025;
twighk 1:8119211eae14 63 }
twighk 1:8119211eae14 64
twighk 1:8119211eae14 65 void relax() { // servo applies no force
twighk 1:8119211eae14 66 PWM = 0;
twighk 1:8119211eae14 67 }
twighk 1:8119211eae14 68
twighk 1:8119211eae14 69 };
twighk 1:8119211eae14 70 */