HCSR04 returning 0s

There are plenty of examples on the web of short programs that will work with that sensor.

Make sure the sensor works with one of those before adding in other functions.