Avoid division by 0 when a frequency of 0 is passed to the tone() function. If a 0 is passed, noTone() is called instead.