ENDLÖSUNG:)

Dependencies:   mbed

Fork of MicroMouse_MASTER_FOUR by PES2_R2D2.0

CheckWalls.cpp

Committer:
ruesipat
Date:
2018-05-22
Revision:
10:e8110fb94686
Parent:
9:ab19796bf14a

File content as of revision 10:e8110fb94686:

#include <cmath>
#include "CheckWalls.h"

using namespace std;

const float CheckWalls::WALL_DISTANCE = 100.0f;

CheckWalls::CheckWalls(IRSensor& irSensor0, IRSensor& irSensor1, IRSensor& irSensor2, int& wallRight, int& wallFront, int& wallLeft):
    irSensor0(irSensor0),
    irSensor1(irSensor1),
    irSensor2(irSensor2),
    wallRight(wallRight),
    wallFront(wallFront),
    wallLeft(wallLeft)
 
{

}

CheckWalls::~CheckWalls() {}

void CheckWalls::check(){
        
        if (irSensor0.read() < WALL_DISTANCE){ //Abstand zur RECHTEN WAND                        
            wallRight = 1; //Wand
        }else{                   
            wallRight = 0; //keine Wand 
        }     
                
        if (irSensor1.read() < WALL_DISTANCE){ //Abstand zur WAND VORNE
            wallFront = 1;  //Wand
        }else{
            wallFront = 0;  //Keine Wand
        }
                
        if (irSensor2.read() < WALL_DISTANCE){ //Anbstand zur LINKEN WAND                        
            wallLeft = 1;   //Wand
        }else{               
            wallLeft = 0;   //keine Wand 
        }                    
}