Need Help with Piezo Buzzer and Ultrasonic Sensor code

When you come to a understanding of it does, report back.

What happens when it is set to zero?