Fertige Version mit geschwindigkeit 100
Dependencies: mbed
Fork of Micromouse_alpha_copy_copy by
Diff: CheckWalls.cpp
- Revision:
- 5:b8b1a979b0d5
- Parent:
- 2:592f01278db4
--- a/CheckWalls.cpp Thu Apr 12 16:14:02 2018 +0000 +++ b/CheckWalls.cpp Wed Apr 25 12:07:03 2018 +0000 @@ -5,14 +5,16 @@ const float CheckWalls::WALL_DISTANCE = 100.0f; -CheckWalls::CheckWalls(float distanceRight, float distanceFront, float distanceLeftFront, int& wallRight, int& wallFront, int& wallLeft): +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) + wallLeft(wallLeft) + { - this->distanceRight = distanceRight; - this->distanceFront = distanceFront; - this->distanceLeftFront = distanceLeftFront; + } @@ -21,19 +23,19 @@ void CheckWalls::check(){ - if (distanceRight < WALL_DISTANCE){ //Abstand zur RECHTEN WAND + if (irSensor0.read() < WALL_DISTANCE){ //Abstand zur RECHTEN WAND wallRight = 1; //Wand }else{ wallRight = 0; //keine Wand } - if (distanceFront < WALL_DISTANCE){ //Abstand zur WAND VORNE + if (irSensor1.read() < WALL_DISTANCE){ //Abstand zur WAND VORNE wallFront = 1; //Wand }else{ wallFront = 0; //Keine Wand } - if (distanceLeftFront < WALL_DISTANCE){ //Anbstand zur LINKEN WAND + if (irSensor2.read() < WALL_DISTANCE){ //Anbstand zur LINKEN WAND wallLeft = 1; //Wand }else{ wallLeft = 0; //keine Wand