Colour sensors calibrated
Dependencies: mbed-rtos mbed Servo QEI
Fork of ICRSEurobot13 by
Revision 5:56a5fdd373c9, committed 2013-04-04
- Comitter:
- madcowswe
- Date:
- Thu Apr 04 14:44:14 2013 +0000
- Parent:
- 4:1be0f6c6ceae
- Child:
- 6:995b3679155f
- Child:
- 8:69bdf20cb525
- Commit message:
- Removed e stop button code, as power will be used through the button instead.
Changed in this revision
--- a/Actuators/Actuator.cpp Wed Apr 03 17:54:53 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - -// Eurobot13 Actuator.cpp - -#include "Actuator.h" - - -Actuator *Actuator::Head = NULL; - -
--- a/Actuators/Actuator.h Wed Apr 03 17:54:53 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -#ifndef __Actuator_h__ -#define __Actuator_h__ -// Eurobot13 Actuator.h - -#include "mbed.h" - -class Actuator { - private: - static Actuator *Head; // Actuator.cpp - Actuator *next; - - public: - Actuator(){ - next = NULL; - if (Head == NULL){ - Head = this; - } else { - Actuator* nxt = Head; - for(;nxt->next != NULL; nxt = nxt->next); - nxt->next = this; - } - } - - virtual void halt (void) = 0; - - static void haltandCatchFire(void){ - DigitalOut myled(LED1); - myled = 1; - //halt - for(Actuator* nxt = Head; nxt != NULL; nxt = nxt->next){ - nxt->halt(); - } - //catchFire - while(true); - } - - -}; - -#endif \ No newline at end of file
--- a/Actuators/Arms/Arm.h Wed Apr 03 17:54:53 2013 +0000 +++ b/Actuators/Arms/Arm.h Thu Apr 04 14:44:14 2013 +0000 @@ -3,9 +3,8 @@ #include "mbed.h" #include "Servo.h" -#include "Actuators/Actuator.h" -class Arm : public Servo, public Actuator +class Arm : public Servo { private: bool updirn; @@ -34,8 +33,8 @@ } virtual void halt() { // servo applies no force - DigitalOut myled(LED3); - myled = 1; + //DigitalOut myled(LED3); + //myled = 1; _pwm = 0; } };
--- a/Actuators/MainMotors/MainMotor.h Wed Apr 03 17:54:53 2013 +0000 +++ b/Actuators/MainMotors/MainMotor.h Thu Apr 04 14:44:14 2013 +0000 @@ -2,9 +2,8 @@ // Eurobot13 MainMotor.h #include "mbed.h" -#include "Actuators/Actuator.h" -class MainMotor: public Actuator{ +class MainMotor{ private: PwmOut PWM1; PwmOut PWM2; @@ -28,8 +27,8 @@ } virtual void halt (void){ - DigitalOut myled(LED2); - myled = 1; + //DigitalOut myled(LED2); + //myled = 1; PWM1 = 0; PWM2 = 0; }
--- a/Others/EmergencyStop/EmergencyStop.h Wed Apr 03 17:54:53 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ - -// Eurobot13 EmergencyStop.h - -#include "mbed.h" -#include "Actuators/Actuator.h" - -class EmergencyStop : public InterruptIn{ - private: - public: - EmergencyStop ( PinName interuptPin - , void (*risefunction)(void) = Actuator::haltandCatchFire - , void (*fallfunction)(void) = Actuator::haltandCatchFire - ) - : InterruptIn(interuptPin) - { - if (risefunction != NULL){ - rise(risefunction); - } - - if (fallfunction != NULL){ - fall(fallfunction); - } - } -}; \ No newline at end of file
--- a/Sensors/Colour/Colour.h Wed Apr 03 17:54:53 2013 +0000 +++ b/Sensors/Colour/Colour.h Thu Apr 04 14:44:14 2013 +0000 @@ -1,6 +1,9 @@ // Eurobot13 Colour.h +//red led use 45ohm +//blue led use 10ohm + #include "mbed.h" #include "Led.h" #include "Phototransistor.h"
--- a/Sensors/Encoders/Encoder.h Wed Apr 03 17:54:53 2013 +0000 +++ b/Sensors/Encoders/Encoder.h Thu Apr 04 14:44:14 2013 +0000 @@ -13,7 +13,7 @@ Encoder(PinName pGreen, PinName pYellow) : green(pGreen) , yellow(pYellow) - , wheel(pGreen,pYellow, NC, 624) + , wheel(pGreen,pYellow, NC, 0, QEI::X4_ENCODING) { green.mode(PullUp); yellow.mode(PullUp);
--- a/main.cpp Wed Apr 03 17:54:53 2013 +0000 +++ b/main.cpp Thu Apr 04 14:44:14 2013 +0000 @@ -7,7 +7,6 @@ #include "Actuators/Arms/Arm.h" #include "Actuators/MainMotors/MainMotor.h" -#include "Others/EmergencyStop/EmergencyStop.h" #include "Sensors/Encoders/Encoder.h" #include "Sensors/Colour/Colour.h" #include "Sensors/Colour/Led.h" @@ -28,16 +27,13 @@ void colourtest(); int main() { -/* Setup EmergencyStop button for actuators. - Derive all actuators from the pure virtual actuator class! -*/ EmergencyStop EStop(p8); /***************** * Test Code * *****************/ //motortest(); //encodertest(); - //motorencodetest(); + motorencodetest(); //motorencodetestline(); //motorsandservostest(); //armtest(); @@ -45,7 +41,7 @@ //ledtest(); //phototransistortest(); //ledphototransistortest(); - colourtest(); // Red SnR too low + //colourtest(); // Red SnR too low } void colourtest(){