So i have made a distance sensor for the second diy assignment, which can be used in railway gates and also recently, i visited sikkim, in which i i found the problems in hill roads. That is when two cars are approaching from two directions. They cant see each other and if the cars want to cross each other, then that can be done at only a curve like this curve, where the wide distance is available. But in these narrow roads, very less dista, very less width is available. So two cars cant cross each other so using this sensor here. So if we will attach a sensor here so that if the if two cars are approaching from left side and a right side, then the then let the left car first comes in close range. With the sensor, then, that sensor will direct the right car to slow down and it will come and stay at the curb until the left car crosses. So in this way the problem can be solved and open ends of my project is lets see. First, i have used a used: a arduino uno r3 and an ultra sonic distance sensor and a positional micro red led and a one kilo ohm. So here i have connected the 5 volt and the ground pins to the positive and negative rails of the breadboard and the ground and power terminals of servo. Motor and ultrasonic sensor are attached accordingly and the wires are colored red and black for ease, and the signal terminal of the sensor is connected with the seventh digital pin and and the signal terminal of servo motor is connected with the six digital pin.

And this is my code so, and my code is such as the when the distance of the object is less than equal to 200 meters. The servo motor gets at zero degrees and the led lights up and when the distance becomes greater than equal to 200 meter. After uh, the led and servo motor comes back to their original position after waiting for 5 seconds, so i will show the stimulation here, as you can see, and here is the simulation. So, as you can see, the distance is uh greater than 200 centimeter, so the servo motor is at 90 degrees and even the led is not lighted, and when i decrease the distance less than 200 centimeter less than 200 centimeter, you can see the servo motor comes Back to zero degree and the led lights up, and when i increase the distance uh suddenly, then you can see that it waits for five seconds. Then the servo motor comes back to its original position and the led light also diminishes. So i have uh copied the uh text, form of the code of that arduino assignment and now i will paste it in the this. I have pasted it in the arduino ide. Now we will verify it so, as you can see it has done compiling there has been no errors. Uh. Thank you.

https://www.youtube.com/watch?v=IUy0LF6KoGU