Code:
#include "RP6RobotBaseLib.h"
int main(void)
{
initRobotBase();
setLEDs(0b111111);
mSleep(2500);
powerON();
switch(move_state)
{
case STATE_START:
setLEDs(0b010000);
move_state = STATE_WAIT_FOR_BUMPER_HIT_LEFT;
break;
case STATE_WAIT_FOR_BUMPER_HIT_LEFT:
if(getStopwatch1() > 500)
{
statusLEDs.LED5 = !statusLEDs.LED5;
updateStatusLEDs();
setStopwatch1(0);
}
if(bumper_left)
{
setLEDs(0b011001);
move(50, BWD, DIST_MM(150), NON_BLOCKING);
move_state = STATE_MOVE_BACKWARDS;
}
while(true)
{
setLEDs(0b110110);
move(75, FWD, DIST_MM(900), true);
setLEDs(0b000111);
rotate(50, RIGHT, 90, true);
setLEDs(0b110110);
move(75, FWD, DIST_MM(500), true);
setLEDs(0b111000);
rotate(50, LEFT, 90, true);
setLEDs(0b110110);
move(75, FWD, DIST_MM(1400), true);
setLEDs(0b000111);
rotate(50, RIGHT, 90, true);
setLEDs(0b110110);
move(75, FWD, DIST_MM(1300), true);
setLEDs(0b000111);
rotate(50, RIGHT, 90, true);
setLEDs(0b110110);
move(75, FWD, DIST_MM(1000), true); //MITTE!
setLEDs(0b111111);
rotate(50, RIGHT, 360, true);
setLEDs(0b111011);
move(75, BWD, DIST_MM(1000), true);
setLEDs(0b111000);
rotate(50, LEFT, 90, true);
setLEDs(0b011011);
move(75, BWD, DIST_MM(1300), true);
setLEDs(0b111000);
rotate(50, LEFT, 90, true);
setLEDs(0b011011);
move(75, BWD, DIST_MM(1400), true);
setLEDs(0b000111);
rotate(50, RIGHT, 90, true);
setLEDs(0b011011);
move(75, BWD, DIST_MM(500), true);
setLEDs(0b111000);
rotate(50, LEFT, 90, true);
setLEDs(0b011011);
move(75, BWD, DIST_MM(900), true);
}
return 0;
}
Ja, ich weiss, dass ich mich doof anstelle, aber die Anleitung verrät ja auch nichts -.-
Lesezeichen