We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6d02a57 + f062157 commit dad271aCopy full SHA for dad271a
Crickit_Sparky_Automaton/code.py
@@ -1,5 +1,5 @@
1
-import time
2
import os
+import time
3
import random
4
import audioio
5
from digitalio import DigitalInOut, Direction
@@ -9,7 +9,8 @@
9
from busio import I2C
10
import board
11
12
-wavefiles = [file for file in os.listdir("/") if file.endswith(".wav")]
+wavefiles = [file for file in os.listdir("/")
13
+ if (file.endswith(".wav") and not file.startswith("._"))]
14
print("Audio files found: ", wavefiles)
15
16
# Create seesaw object
@@ -33,6 +34,7 @@
33
34
35
# Audio playback object and helper to play a full file
36
a = audioio.AudioOut(board.A0)
37
+
38
def play_file(wavfile):
39
print("Playing", wavfile)
40
with open(wavfile, "rb") as f:
@@ -46,5 +48,4 @@ def play_file(wavfile):
46
48
47
49
while True:
50
play_file(random.choice(wavefiles))
-
51
time.sleep(3)
0 commit comments