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 28
28
* Author(s): Scott Shawcroft
29
29
"""
30
30
import time
31
+ import sys
31
32
import array
32
33
import digitalio
33
34
import pulseio
34
35
try :
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 :
38
40
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.
44
42
try :
45
- from audiopwmio import PWMAudioOut as AudioOut
43
+ from audioio import AudioOut
46
44
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!
48
48
49
49
def tone (pin , frequency , duration = 1 , length = 100 ):
50
50
"""
You can’t perform that action at this time.
0 commit comments