Ultrasonic sensor with LED, how can I do this?

aarg, I like your logic on line 64, that was really helpful.