while_Bertl Funktionen mit Task1,3

Dependencies:   mbed

Fork of while_Bertl123 by Julian Roll

NewClass.cpp

Committer:
Pouter123
Date:
2015-04-24
Revision:
1:b6d7de0d8613
Parent:
0:1d90336fdde0
Child:
2:c2551ea9238b

File content as of revision 1:b6d7de0d8613:

#include "mbed.h"
#include "NewClass.h"
#include "ur_Bertl.h"
#include "config.h"
#include "const.h"



void NewClass :: ClearAllBeepersToTheWall()
{
    PickBeeper();
    while(FrontIsClear())
    {  
        Move();
        PickBeeper();
    }
    
}


void NewClass :: MoveUntilPickBeeper()
{
    while(!(NextToABeeper()))
{
    Move();
        
}
    PickBeeper();
    
}

void NewClass :: Task3()
{   
int x = 0;
    while(FrontIsClear())
    {
        Move();
        if((NextToABeeper())&&(x==0))
        {
            PickBeeper();
            TurnLeft();
            x++;
        }
        else if(NextToABeeper())
        {
            PickBeeper();
            x++; 
        }
        else
        {
            TurnLeft();
            TurnLeft();
            for(int i = 0; i <= (x-1); x++)
                Move();
            TurnLeft();
            if(FrontIsClear())
                Move();
            x = 0;   
        }
    }
}