File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 2828* Author(s): Scott Shawcroft
2929"""
3030import time
31+ import sys
3132import array
3233import digitalio
3334import pulseio
3435try :
35- import audiocore
36- except ImportError :
37- try :
36+ # RawSample was moved in CircuitPython 5.x.
37+ if sys .implementation .version [0 ] >= 5 :
38+ import audiocore
39+ else :
3840 import audioio as audiocore
39- except ImportError :
40- pass # not always supported by every board!
41- try :
42- from audioio import AudioOut
43- except ImportError :
41+ # Some boards have AudioOut (true DAC), others have PWMAudioOut.
4442 try :
45- from audiopwmio import PWMAudioOut as AudioOut
43+ from audioio import AudioOut
4644 except ImportError :
47- pass # not always supported by every board!
45+ from audiopwmio import PWMAudioOut as AudioOut
46+ except ImportError :
47+ pass # not always supported by every board!
4848
4949def tone (pin , frequency , duration = 1 , length = 100 ):
5050 """
You can’t perform that action at this time.
0 commit comments