This project shows how to move a servo motor using Ultrasonic sensor as a trigger. The sensor must satisfy the given condition before the servo will move.

You need a servo an arduino and Ultrasonic. Groung and +5V of ultrasonic is connected together with the ground and +5V of servo motor.