Skip to content

Commit dad271a

Browse files
authored
Merge pull request adafruit#226 from adafruit/TheKitty-patch-2
Eliminate finding mac specific files
2 parents 6d02a57 + f062157 commit dad271a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Crickit_Sparky_Automaton/code.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import time
21
import os
2+
import time
33
import random
44
import audioio
55
from digitalio import DigitalInOut, Direction
@@ -9,7 +9,8 @@
99
from busio import I2C
1010
import board
1111

12-
wavefiles = [file for file in os.listdir("/") if file.endswith(".wav")]
12+
wavefiles = [file for file in os.listdir("/")
13+
if (file.endswith(".wav") and not file.startswith("._"))]
1314
print("Audio files found: ", wavefiles)
1415

1516
# Create seesaw object
@@ -33,6 +34,7 @@
3334

3435
# Audio playback object and helper to play a full file
3536
a = audioio.AudioOut(board.A0)
37+
3638
def play_file(wavfile):
3739
print("Playing", wavfile)
3840
with open(wavfile, "rb") as f:
@@ -46,5 +48,4 @@ def play_file(wavfile):
4648

4749
while True:
4850
play_file(random.choice(wavefiles))
49-
5051
time.sleep(3)

0 commit comments

Comments
 (0)