Ping Arduino Led and Switch

You've provided no information on how the switch is wired. You are not using the internal pullup resistor, so wiring the switch is more difficult than it needs to be.

It seems to me that you need not bother with reading the ping sensor if the switch is not pressed. All the situations where the switch is not pressed result in the LED pin being LOW, regardless of the ping distance, so you need not bother reading the sensor.