Using the Arduino, I created a device with an input-output relationship where as one gets closer to the Ultra Sonic Ranger, the distance is read and the LED turns off.  However, as the distance increases from the object, the LED turns back on.

 

 

https://youtu.be/OhzI_jaiips