diff --git a/autonomousCar/autonomousCar.ino b/autonomousCar/autonomousCar.ino index 1b67a78..37c1700 100644 --- a/autonomousCar/autonomousCar.ino +++ b/autonomousCar/autonomousCar.ino @@ -259,14 +259,15 @@ void park(int parkingNo) { int row = (parkingNo / 2) + 1; int side = (parking % 2) //If side is 1 then the parking is to right // else if is 0 the parking is to left. + distance= getDistance(); //take the distance from ultrasonic sensor - while (row > 0) { + while (row > 1) { absolute(255); forward(); delay(FORWARD_STEP); motor_stop(); - r--; + row--; } //Check the side value to turn. @@ -278,11 +279,12 @@ void park(int parkingNo) { forward(); delay(TURN_TIME); motor_stop(); - - absolute(255); - forward(); - delay(400); + while(distance<10){ + absolute(255); + forward(); + } + motor_stop(); }