Sketch #4 – The Mustang Barrier – Mona Safari

the-mustang-barrier

For this sketch, I used an ultrasonic sensor and a micro servo. When a vehicle arrives, the ultrasonic sensor will be activated to raise/lower the gate according to the distance between objects. When an obstacle is detected by the sensor, the Arduino board will send a command to the servo to raise the shaft by degrees. After a few delays, the shaft will return to its original position. I also used a USB power supply, but battery power would also work.

https://github.com/msvive/ArduinoMiniProjects/blob/49b4ffa90927f5e9d2bd742a6a5587739952b00d/The%20Mustang%20Barrier.ino