|
|
@ -124,8 +124,6 @@ void setup() { |
|
|
|
void serialFlush(){ |
|
|
|
while(Serial.available() > 0) { |
|
|
|
char t = Serial.read(); |
|
|
|
if(t == '\0') |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -286,9 +284,8 @@ void park(int parkingNo) { |
|
|
|
absolute(255); |
|
|
|
|
|
|
|
while(getDistance()>10){ |
|
|
|
absolute(255); |
|
|
|
forward(); |
|
|
|
delay(300); |
|
|
|
delay(100); |
|
|
|
} |
|
|
|
motor_stop(); |
|
|
|
} |
|
|
@ -319,13 +316,13 @@ int Serial_Input() |
|
|
|
|
|
|
|
void loop() { |
|
|
|
// Calculating the distance
|
|
|
|
//distance= getDistance();
|
|
|
|
distance= getDistance(); |
|
|
|
|
|
|
|
// Prints the distance on the Serial Monitor
|
|
|
|
//Serial.print("Distance: ");
|
|
|
|
//Serial.println(distance);
|
|
|
|
// Serial.println(distance);
|
|
|
|
// Read serial input:
|
|
|
|
park(Serial_Input()); |
|
|
|
park(Serial_Input()); |
|
|
|
//delay(800);
|
|
|
|
// if (distance <15) {
|
|
|
|
// // Change direction to motors
|
|
|
|