File tree Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Original file line number Diff line number Diff line change
1
+ import adafruit_sdcard
2
+ import storage
1
3
from pyoa_graphics import PYOA_Graphics
4
+ import board
5
+ import digitalio
2
6
3
-
7
+ try :
8
+ sdcard = adafruit_sdcard .SDCard (board .SPI (), digitalio .DigitalInOut (board .SD_CS ))
9
+ vfs = storage .VfsFat (sdcard )
10
+ storage .mount (vfs , "/sd" )
11
+ print ("SD card found" ) # no biggie
12
+ except OSError :
13
+ print ("No SD card found" ) # no biggie
4
14
5
15
gfx = PYOA_Graphics ()
6
16
7
- gfx .load_game ("/Adafruit_CircuitPython_PYOA /robots" )
8
- current_card = 2 # start with first card
17
+ gfx .load_game ("/sd /robots" )
18
+ current_card = 0 # start with first card
9
19
10
20
while True :
11
21
print ("Current card:" , current_card )
Original file line number Diff line number Diff line change @@ -132,12 +132,18 @@ def display_card(self, card_num):
132
132
p = self .ts .touch_point
133
133
if p :
134
134
print ("touch: " , p )
135
- if self ._left_button .contains (p ):
136
- print ("Left button" )
137
- goto_page = card .get ('button01_goto_page_id' , None )
138
- if self ._right_button .contains (p ):
139
- print ("Right button" )
140
- goto_page = card .get ('button02_goto_page_id' , None )
135
+ if button01_text and not button02_text :
136
+ # showing only middle button
137
+ if self ._middle_button .contains (p ):
138
+ print ("Middle button" )
139
+ goto_page = card .get ('button01_goto_page_id' , None )
140
+ if button01_text and button02_text :
141
+ if self ._left_button .contains (p ):
142
+ print ("Left button" )
143
+ goto_page = card .get ('button01_goto_page_id' , None )
144
+ if self ._right_button .contains (p ):
145
+ print ("Right button" )
146
+ goto_page = card .get ('button02_goto_page_id' , None )
141
147
self .play_sound (None ) # stop playing any sounds
142
148
for i , c in enumerate (self ._game ):
143
149
if c .get ('page_id' , None ) == goto_page :
You can’t perform that action at this time.
0 commit comments