Skip to content

Commit 491d0ee

Browse files
authored
Merge pull request #55 from KTibow/patch-1
Don't let users play a tone equal or less than 0
2 parents 5c6d563 + 291edae commit 491d0ee

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)