Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions HalloWing_Jump_Scare_Trap/hallowing_jump_scare_trap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import audioio
import audiocore
# Setup LED and PIR pins
LED_PIN = board.D13 # Pin number for the board's built in LED.
LED_PIN = board.LED # Pin number for the board's built in LED.
PIR_PIN = board.SENSE # Pin port connected to PIR sensor output wire.
# Setup digital input for PIR sensor:
pir = digitalio.DigitalInOut(PIR_PIN)
Expand Down Expand Up @@ -94,16 +94,21 @@ def blink(count, speed):
"trap_set.bmp"]
# Function for displaying images on HalloWing TFT screen
def show_image(filename):
# CircuitPython 6 & 7 compatible
image_file = open(filename, "rb")
odb = displayio.OnDiskBitmap(image_file)
face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0, 0))
face = displayio.TileGrid(
odb,
pixel_shader=getattr(odb, 'pixel_shader', displayio.ColorConverter())
)

# # CircuitPython 7+ compatible
# odb = displayio.OnDiskBitmap(filename)
# face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)

backlight.duty_cycle = 0
splash.append(face)
# Wait for the image to load.
try:
board.DISPLAY.refresh(target_frames_per_second=60)
except AttributeError:
board.DISPLAY.wait_for_frame()
board.DISPLAY.refresh(target_frames_per_second=60)
backlight.duty_cycle = max_brightness

beep(1) # startup beep
Expand Down