Reverse parking embedded system software it is detect the distance between the sensor and object. According to distance it will be shows various colors LED.
A reverse parking system is very helpful in cars. This software is detects the distance between a car and an object and, according to it, gives a warning.
This system is helpful in big vehicles like smart trucks, buses, sheep, etc.
Used components for this project :-
1 Arduino board
1 Ultrasonic Sensor
3 LED
3 Register
Cables
Here, 3 LEDs are connected in digital pins and give a output according to detected distance.
Ultrasonic sensor has 3 connected cables. In this 1 cable is for 5V power supply, 1 cable for ground and one cable is connected in digital pins for read data and send instructions.
int inches = 0;
int cm = 0;
long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT);
// Clear the trigger
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
// Sets the trigger pin to HIGH state for 10 microseconds
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
// Reads the echo pin, and returns the sound wave travel time in microseconds
return pulseIn(echoPin, HIGH);
}
void setup()
{
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
Serial.begin(9600);
}
void loop()
{
// measure the ping time in cm
cm = 0.01723 * readUltrasonicDistance(7, 7);
// convert to inches by dividing by 2.54
inches = (cm / 2.54);
if(inches < 117 && inches > 50)
{
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(4, HIGH);
delay(100);
digitalWrite(4, LOW);
delay(100);
}
if(inches < 50 && inches > 25)
{
digitalWrite(4, LOW);
digitalWrite(6, LOW);
digitalWrite(5, HIGH);
delay(50);
digitalWrite(5, LOW);
delay(50);
}
if(inches < 25 && inches > 0)
{
digitalWrite(5, LOW);
digitalWrite(4, LOW);
digitalWrite(6, HIGH);
delay(25);
digitalWrite(6, LOW);
delay(25);
}
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.println("cm");
delay(100); // Wait for 100 millisecond(s)
}
Sign in to your account
I really like reading and I think this website got some genuinely useful stuff on it! .