Interfacing Ultrasonic sound sensor with Arduino(Vehicle reverse Alarm)
Interfacing Ultrasonic sound sensor with Arduino(Vehicle reverse Alarm) const int trig = 2;//Trigger pin of Hcsr04 is connected to Digital Pin 2 of arduino. const int echo = 3;//Echo pin of Hcsr04 is connected to digital Pin 3 of Arduino. const int LED1 = 8;//LED1(Yellow)connected to digital pin 8 of Arduino. const int LED2 = 7;//LED2(Green)connected to digital pin 7 of Arduino. const int LED3 = 6;//LED3(Blue)connected to digital pin 6 of Arduino. const int LED4 = 5;//LED4(Red)connected to digital pin 5 of Arduino. const int Buzzer = 4;//Buzzer connected to digital pin 4 of arduino //const int LED5 = 11;//optional //const int LED6 = 12;//optional //const int LED7 = 13;//optional int duration = 0; int distance = 0; void setup() { pinMode(trig , OUTPUT);//Initialized Trigger Pin is an Output pinMode(echo , INPUT);//Initialized Echo Pin is an input. pinMode(LED1 , OUTPUT);//Initialized Led1 is an Output pinMode(LED2 , OUTPUT);//Initiali...