Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of MicroMouse_MASTER_FOUR by
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 }
Generated on Wed Jul 20 2022 03:14:21 by
1.7.2
