bbcmicrobit / micropython

Port of MicroPython for the BBC micro:bit
https://microbit-micropython.readthedocs.io
Other
595 stars 287 forks source link

audio.play sets pin1 high and leaves it that way #728

Open kevinjwalters opened 2 years ago

kevinjwalters commented 2 years ago

I noticed that audio.play which is documented as having defaults of pin0 and no return_pin will set pin1 and will leave it that way.

MicroPython v1.9.2-34-gd64154c73 on 2017-09-01; micro:bit v1.0.1 with nRF51822
Type "help()" for more information.
>>>
>>> import audio
>>> frame = audio.AudioFrame()
>>> audio.play([frame] * 20)  # this will set pin1 high
>>> audio.play([frame] * 20, pin=pin0)  # pin1 still high after this
>>> pin1.read_digital()  # set to read mode
1
>>> audio.play([frame] * 20, pin=pin0) # this just plays on pin0, pin1 now unaffected

This happens to be on a microbit V1, haven't tried a V2.

BTW, can mono audio be sent to two pins?