adafruit / Adafruit_CircuitPython_RTTTL

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

Invalid Pin error on PyPortal #28

Closed FoamyGuy closed 2 years ago

FoamyGuy commented 2 years ago

I attempted to run the simpletest for this library on a PyPortal with 7.1.0 beta release. I tried board.SPEAKER and board.AUDIO_OUT as well as board.A0 though I suspect all of them are aliases for the same pin so it shouldn't make a difference.

All of them fail the same way and print this error:

Traceback (most recent call last):
  File "code.py", line 38, in <module>
  File "/lib/adafruit_rtttl.py", line 203, in play
ValueError: Invalid pin

I peeked briefly into the code and I think there might be an issue with the logic that determines whether audioio module is available on a given device / pin. I think that should be available on my pyportal but this library is ending up with False for the value of AUDIOIO_AVAILABLE variable which is making it try PWM instead which ultimately raises the error above.