while_Bertl Funktionen mit Task1,3

Dependencies:   mbed

Fork of while_Bertl123 by Julian Roll

NewClass.cpp

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

File content as of revision 2:c2551ea9238b:

#include "mbed.h"
#include "NewClass.h"
#include "ur_Bertl.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))
        {
            TurnLeft();
            x++;
        }
        else if(NextToABeeper())
        {
            x++; 
        }
        else
        {
            TurnLeft();
            TurnLeft();
            for(int i = 0; i <= (x-1); x++)
                Move();
            TurnLeft();
            if(FrontIsClear())
                Move();
            x = 0;   
        }
    }
}

void NewClass :: Task1()
{
   TurnLedOff(LED_ALL);
   while(1)
   {
        while(IsButtonPressed(BTN_FLL))
        {
           TurnLedOn(LED_FL1); 
        }
        TurnLedOff(LED_ALL);
        while(IsButtonPressed(BTN_FRR))
        {
           TurnLedOn(LED_FR1); 
        }
        TurnLedOff(LED_ALL);
        while(IsButtonPressed(BTN_BL))
        {
           TurnLedOn(LED_BL1);  
        }
        TurnLedOff(LED_ALL);
        while(IsButtonPressed(BTN_BR))
        {
           TurnLedOn(LED_BR1); 
        }
        TurnLedOff(LED_ALL);
    } 
    
    
}