Skip to content

Commit 92d9e93

Browse files
authored
Merge branch 'master' into philb-branch
2 parents fa512a8 + f923511 commit 92d9e93

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

Slideshows_Soundtrack/slideshows_soundtrack.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,38 @@
11
import board
22
from adafruit_slideshow import SlideShow, PlayBackDirection
33
import audioio
4+
import digitalio
45
import touchio
56

67
# Create the slideshow object that plays through once alphabetically.
78
slideshow = SlideShow(board.DISPLAY)
89

9-
# Create the touch objects on the first and last teeth
10-
back_button = touchio.TouchIn(board.TOUCH1)
11-
forward_button = touchio.TouchIn(board.TOUCH4)
10+
# Set the touch objects to the first and last teeth
11+
back_pin = board.TOUCH1
12+
forward_pin = board.TOUCH4
13+
14+
# Perform a couple extra steps for the HalloWing M4
15+
try:
16+
if getattr(board, "CAP_PIN"):
17+
# Create digitalio objects and pull low for HalloWing M4
18+
cap_pin = digitalio.DigitalInOut(board.CAP_PIN)
19+
cap_pin.direction = digitalio.Direction.OUTPUT
20+
cap_pin.value = False
21+
if getattr(board, "SPEAKER_ENABLE"):
22+
# Enable the Speaker
23+
speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
24+
speaker_enable.direction = digitalio.Direction.OUTPUT
25+
speaker_enable.value = True
26+
except AttributeError:
27+
pass
28+
29+
# Create the touchio objects for HalloWing M0
30+
back_button = touchio.TouchIn(back_pin)
31+
forward_button = touchio.TouchIn(forward_pin)
1232

1333
# Setup the speaker output
1434
a = audioio.AudioOut(board.SPEAKER)
1535

16-
1736
# Helper function that takes in the file name string, splits it at the period, and keeps only the
1837
# beginning of the string. i.e. kitten.bmp becomes kitten.
1938
def basename(file_name):

0 commit comments

Comments
 (0)