Skip to content

Commit 291edae

Browse files
authored
Don't let users play a tone equal or less than 0
1 parent 5c6d563 commit 291edae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

adafruit_magtag/peripherals.py

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def play_tone(self, frequency, duration):
7373
It will attempt to play the sound up to 3 times in the case of
7474
an error.
7575
"""
76+
if frequency <= 0:
77+
raise ValueError("The frequency has to be greater than 0.")
7678
self._speaker_enable.value = True
7779
attempt = 0
7880
# Try up to 3 times to play the sound

0 commit comments

Comments
 (0)