diff --git a/adafruit_magtag/peripherals.py b/adafruit_magtag/peripherals.py index 903d444..69c28cf 100755 --- a/adafruit_magtag/peripherals.py +++ b/adafruit_magtag/peripherals.py @@ -73,6 +73,8 @@ def play_tone(self, frequency, duration): It will attempt to play the sound up to 3 times in the case of an error. """ + if frequency <= 0: + raise ValueError("The frequency has to be greater than 0.") self._speaker_enable.value = True attempt = 0 # Try up to 3 times to play the sound