PES2_R2D2.0 / Mbed 2 deprecated MicroMouse_MASTER_FIVE

Dependencies:   mbed

Fork of MicroMouse_MASTER_FOUR by PES2_R2D2.0

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CheckWalls.cpp Source File

CheckWalls.cpp

00001 #include <cmath>
00002 #include "CheckWalls.h"
00003 
00004 using namespace std;
00005 
00006 const float CheckWalls::WALL_DISTANCE = 100.0f;
00007 
00008 CheckWalls::CheckWalls(IRSensor& irSensor0, IRSensor& irSensor1, IRSensor& irSensor2, int& wallRight, int& wallFront, int& wallLeft):
00009     irSensor0(irSensor0),
00010     irSensor1(irSensor1),
00011     irSensor2(irSensor2),
00012     wallRight(wallRight),
00013     wallFront(wallFront),
00014     wallLeft(wallLeft)
00015  
00016 {
00017 
00018 }
00019 
00020 CheckWalls::~CheckWalls() {}
00021 
00022 void CheckWalls::check(){
00023         
00024         if (irSensor0.read() < WALL_DISTANCE){ //Abstand zur RECHTEN WAND                        
00025             wallRight = 1; //Wand
00026         }else{                   
00027             wallRight = 0; //keine Wand 
00028         }     
00029                 
00030         if (irSensor1.read() < WALL_DISTANCE){ //Abstand zur WAND VORNE
00031             wallFront = 1;  //Wand
00032         }else{
00033             wallFront = 0;  //Keine Wand
00034         }
00035                 
00036         if (irSensor2.read() < WALL_DISTANCE){ //Anbstand zur LINKEN WAND                        
00037             wallLeft = 1;   //Wand
00038         }else{               
00039             wallLeft = 0;   //keine Wand 
00040         }                    
00041 }