Need help with some logic in my sketch.

I think I'm going to add some ping sensors at the top and bottom of the garage door. If the door is close to the sensor at the top then door = open. If the door is close to the sensor at the bottom then door = closed. Seems like a decent way to detect the door's state rather than simply an on/off switch.