Project Presentationon Automaticbrakingsystem
Project Presentationon Automaticbrakingsystem
Project Presentationon Automaticbrakingsystem
Ultrasonic
Sensor
Sensor Receiver
Braking Circuit
Vehicle Brake
#define trigPin 6
#define echoPin 7
#define led 13
#define led2 10
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW); // Added this line
delayMicroseconds(2); // Added this line
digitalWrite(trigPin, HIGH);
delayMicroseconds(10); // Added this line
digitalWrite(trigPin, LOW);
Coding
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
Serial.print(distance);
Serial.println(" cm");
if (distance < 100 ) { // This is where the LED On/Off happens
digitalWrite(led,HIGH); // When the Red condition is met, the
Green LED should turn off
delay(1);
}
//if (distance > 160 ) {
// digitalWrite(led,LOW); // When the Red condition is met, the
Green LED should turn off
// delay(1);
// delayMicroseconds(2);
//}
else {
digitalWrite(led,LOW);
delay(1);
}
// }
//}
Specifications
The overall specifications of the system is showing in the following Table 1
Table 1 Overall specifications of the system