adafruit / Adafruit_CircuitPython_RTTTL

Play RTTTL tunes in CircuitPython
MIT License
4 stars 12 forks source link

Result of PWM Functionality Test #6

Closed CedarGroveStudios closed 6 years ago

CedarGroveStudios commented 6 years ago

1) rtttl_simpletest.py doesn't work for PWM output. 2) Print statements in lines 133 and 165 in adafruit_rtttl.py appear to be left over from debugging. If verbose output is required, consider providing an on/off parameter. Suggest updating the documentation accordingly. 2) In PWM mode on the Gemma M0, adafruit_rtttl doesn't release the output pin to allow playing more than one sequence.

Test code (adapted from the AdaBox007 Learning Guide):

import adafruit_rtttl
import board
import time

a_team = "The A Team:d=8,o=5,b=132:4d#6,a#,2d#6,16p,g#,4a#,4d#.,p,16g,16a#,d#6,a#,f6,2d#6,16p,c#.6,16c6,16a#,g#.,2a#."
bond = "Bond:d=4,o=5,b=320:c,8d,8d,d,2d,c,c,c,c,8d#,8d#,d#,2d#,d,d,d,c,8d,8d,d,2d,c,c,c,c,8d#,8d#,d#,2d#,d,c#,c,c6,1b.,g,f,2g."

while True:
    adafruit_rtttl.play(board.D0, bond)
    adafruit_rtttl.play(board.D0, a_team)

Throws the error:

Traceback (most recent call last):
  File "main.py", line 11, in <module>
  File "adafruit_rtttl.py", line 179, in play
ValueError: Pin PA04 in use
tannewt commented 6 years ago

Good find! I'll fix it later today or tomorrow. We need to call deinit.

CedarGroveStudios commented 6 years ago

Successfully tested the fix on a Gemma M0. Thanks!