This is some awesome robot code
Dependencies: mbed-rtos mbed QEI
Fork of ICRSEurobot13 by
Diff: main.cpp
- Revision:
- 2:45da48fab346
- Parent:
- 1:8119211eae14
- Child:
- 3:717de74f6ebd
diff -r 8119211eae14 -r 45da48fab346 main.cpp --- a/main.cpp Fri Mar 29 16:28:56 2013 +0000 +++ b/main.cpp Fri Mar 29 20:09:21 2013 +0000 @@ -6,8 +6,9 @@ #include "Actuators/MainMotors/MainMotor.h" #include "Sensors/Encoders/Encoder.h" #include "Actuators/Arms/Arm.h" +#include "Others/EmergencyStop/EmergencyStop.h" -PwmOut Led(LED1); + void motortest(); void encodertest(); @@ -15,15 +16,21 @@ void motorencodetestline(); void motorsandservostest(); void armtest(); +void motortestline(); int main() { +/* Setup Emergency stop for actuators, + Derive all actuators from the pure virtual actuator class +*/ EmergencyStop EStop(p8); + //motortest(); //encodertest(); //motorencodetest(); //motorencodetestline(); //motorsandservostest(); armtest(); -} + //motortestline(); + } void armtest(){ Arm white(p26), black(p25, false,0.0005, 180); @@ -61,7 +68,7 @@ if (servoTimer.read() < 1){ sTop.clockwise(); } else if (servoTimer.read() < 4) { - sTop.relax(); + sTop.halt(); } else if (servoTimer.read() < 5) { sBottom.anticlockwise(); //Led=1; @@ -69,7 +76,7 @@ sBottom.clockwise(); //Led=0; } else if (servoTimer.read() < 7) { - sBottom.relax(); + sBottom.halt(); }else { sTop.anticlockwise(); } @@ -77,6 +84,13 @@ } } +void motortestline(){ + MainMotor mleft(p24,p23), mright(p21,p22); + const float speed = 0.2; + mleft(speed); mright(speed); + while(true) wait(1); +} + void motorencodetestline(){ Encoder Eleft(p27, p28), Eright(p30, p29); MainMotor mleft(p24,p23), mright(p21,p22);