Skip to content

Commit f6e12ed

Browse files
committed
[FIX] music fix
1 parent f55caf8 commit f6e12ed

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

elio.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Eliobot robot Library
2-
# version = '2.0'
2+
# version = '2.1'
33
# 2023 ELIO SAS
44
#
55
# Project home:
@@ -303,7 +303,7 @@ def play_tone(self, frequency, duration, volume):
303303
self.buzzer.frequency = round(frequency)
304304
self.buzzer.duty_cycle = int(2 ** (0.06 * volume + 9))
305305
time.sleep(duration)
306-
buzzer.deinit()
306+
self.buzzer.duty_cycle = 0
307307

308308
def play_note(self, note, duration, NOTES_FREQUENCIES, volume):
309309
"""
@@ -319,6 +319,7 @@ def play_note(self, note, duration, NOTES_FREQUENCIES, volume):
319319
frequency = NOTES_FREQUENCIES[note]
320320
if frequency != 0.1:
321321
self.play_tone(frequency, duration, volume)
322+
self.buzzer.duty_cycle = 0
322323
else:
323324
time.sleep(duration)
324325

@@ -437,7 +438,7 @@ def save_calibration_data(threshold):
437438
threshold (float): The calculated threshold value for line detection.
438439
"""
439440
calibration_data = {
440-
'threshold': threshold
441+
'line_threshold': threshold
441442
}
442443
with open('config.json', 'w') as file:
443444
json.dump(calibration_data, file)

0 commit comments

Comments
 (0)