Skip to content

Commit 60a005c

Browse files
authored
Merge pull request #1759 from lesamouraipourpre/hallowing-jump-scare-trap
HalloWing Jump Scare Trap: Update for CP7
2 parents 04c3bcd + ca06d3c commit 60a005c

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

HalloWing_Jump_Scare_Trap/hallowing_jump_scare_trap.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import audioio
1313
import audiocore
1414
# Setup LED and PIR pins
15-
LED_PIN = board.D13 # Pin number for the board's built in LED.
15+
LED_PIN = board.LED # Pin number for the board's built in LED.
1616
PIR_PIN = board.SENSE # Pin port connected to PIR sensor output wire.
1717
# Setup digital input for PIR sensor:
1818
pir = digitalio.DigitalInOut(PIR_PIN)
@@ -94,16 +94,21 @@ def blink(count, speed):
9494
"trap_set.bmp"]
9595
# Function for displaying images on HalloWing TFT screen
9696
def show_image(filename):
97+
# CircuitPython 6 & 7 compatible
9798
image_file = open(filename, "rb")
9899
odb = displayio.OnDiskBitmap(image_file)
99-
face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0, 0))
100+
face = displayio.TileGrid(
101+
odb,
102+
pixel_shader=getattr(odb, 'pixel_shader', displayio.ColorConverter())
103+
)
104+
105+
# # CircuitPython 7+ compatible
106+
# odb = displayio.OnDiskBitmap(filename)
107+
# face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)
108+
100109
backlight.duty_cycle = 0
101110
splash.append(face)
102-
# Wait for the image to load.
103-
try:
104-
board.DISPLAY.refresh(target_frames_per_second=60)
105-
except AttributeError:
106-
board.DISPLAY.wait_for_frame()
111+
board.DISPLAY.refresh(target_frames_per_second=60)
107112
backlight.duty_cycle = max_brightness
108113

109114
beep(1) # startup beep

0 commit comments

Comments
 (0)