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