|
|
@ -10,6 +10,7 @@ |
|
|
|
const int trigPin = 9; |
|
|
|
const int echoPin = 10; |
|
|
|
const int response = 6; |
|
|
|
const int id = 1; |
|
|
|
|
|
|
|
// defines variables
|
|
|
|
long duration; |
|
|
@ -43,11 +44,11 @@ distance= duration*0.034/2; |
|
|
|
//Serial.println(distance);
|
|
|
|
|
|
|
|
if (distance < 5){ |
|
|
|
Serial.println("0"); //parking isn't available.
|
|
|
|
Serial.println(id+"#0"); //parking isn't available.
|
|
|
|
digitalWrite(response, LOW); |
|
|
|
} |
|
|
|
else{ |
|
|
|
Serial.println("1"); //parking is available.
|
|
|
|
Serial.println(id+"#1"); //parking is available.
|
|
|
|
digitalWrite(response, HIGH); |
|
|
|
} |
|
|
|
|
|
|
|