Bertl sammelt Beeper und fährt die anzahl der Beeper nach oben und fährt zum Ausgangspunkt.

Dependencies:   mbed ur_Bertl

Fork of While_Task3 by Martina Le

main.cpp

Committer:
martinale
Date:
2015-04-24
Revision:
0:27a5933a5e04
Child:
1:d8c1ed589950

File content as of revision 0:27a5933a5e04:

#include "mbed.h"
#include "Robot.h"
#include "const.h"

class Bertl_Beeper : public Robot
{
public:
    void ClearAllBeeperToTheWall();
    void TurnAround();
};

void Bertl_Beeper :: TurnAround()
{
    TurnLeft();
    TurnLeft();
}

void Bertl_Beeper :: ClearAllBeeperToTheWall()
{
    while(FrontIsClear()) 
    {
        if(NextToABeeper()) 
        {
            PickBeeper();
            NibbleLeds(AnyBeeperInBag());
            wait(1);
            Move();
        } else
            Move();
    }
}

int main()
{
    Bertl_Beeper karel;

    while(1) 
    {
        karel.ClearAllBeeperToTheWall();
        while(!karel.FrontIsClear()) 
        {
            karel.TurnAround();
            break;
        }
    }
}