x=spot["pos"][0],
        y=spot["pos"][1],
        width=spot["size"][0],
        height=spot["size"][1],
        fill_color=fill,
        outline_color=outline,
        label=spot["label"],
        label_color=None,
        name=spot["file"],
    )
    pyportal.splash.append(button.group)
    buttons.append(button)

last_pressed = None
currently_pressed = None
while True:
    p = pyportal.touchscreen.touch_point
    if p:
        print(p)
        for b in buttons:
            if b.contains(p):
                print("Touched", b.name)
                if currently_pressed != b:  # don't restart if playing
                    pyportal.play_file(cwd + "/" + b.name,
                                       wait_to_finish=False)
                currently_pressed = b
                break
        else:
            currently_pressed = None
    time.sleep(0.05)
    default_bg=cwd + "/adabot_cover.bmp",
    text_font=cwd + "/fonts/Collegiate-50.bdf",
    text_position=((40, 100)),
    text_color=(0x8080FF),
    text_maxlen=(
        4),  # max text length, only want first 4 chars for number of guides
    caption_text=CAPTION,
    caption_font=cwd + "/fonts/Collegiate-24.bdf",
    caption_position=(40, 60),
    caption_color=0xFFFFFF)

# track the last value so we can play a sound when it updates
last_value = 0

while True:
    try:
        value = pyportal.fetch()
        print("Response is", value)
        int_value = int(value[:4])  # save only first 4 chars and cast to int
        if last_value < int_value:  # ooh it went up!
            print("New guide!")
            pyportal.play_file(cwd + "/coin.wav")  # make a noise!
        last_value = int_value
    except RuntimeError as e:
        print("Some error occured, retrying! -", e)
    except ValueError as e:
        print("Value error occured, retrying! -", e)
        continue

    time.sleep(600)  #update every 10 mins
Ejemplo n.º 3
0
# the current working directory (where this file is)
cwd = ("/" + __file__).rsplit('/', 1)[0]
pyportal = PyPortal(url=DATA_SOURCE,
                    json_path=(LIKES_LOCATION, VIEWS_LOCATION),
                    status_neopixel=board.NEOPIXEL,
                    default_bg=cwd + "/hackster_background.bmp",
                    text_font=cwd + "/fonts/Arial-Bold-24.bdf",
                    text_position=((80, 75), (80, 145)),
                    text_color=(0x0000FF, 0x000000),
                    caption_text=CAPTION,
                    caption_font=cwd + "/fonts/Arial-12.bdf",
                    caption_position=(20, 200),
                    caption_color=0x000000)

# track the last value so we can play a sound when it updates
last_likes = 0

while True:
    try:
        likes, views = pyportal.fetch()
        print("Views", views, "Likes", likes)
        if last_likes < likes:  # ooh it went up!
            print("New respect!")
            pyportal.play_file(cwd + "/coin.wav")
        last_likes = likes
    except RuntimeError as e:
        print("Some error occured, retrying! -", e)

    time.sleep(60)
Ejemplo n.º 4
0
import displayio
from analogio import AnalogIn
from adafruit_pyportal import PyPortal

analogin = AnalogIn(board.LIGHT)

cwd = ("/" + __file__).rsplit('/', 1)[0]

laura = (cwd + "/laura.bmp")

woodsman = (cwd + "/woodsman.bmp")

gottaLight = (cwd + "/gottaLight.wav")

pyportal = PyPortal(default_bg=laura)


def getVoltage(pin):  # helper
    return (pin.value * 3.3) / 65536


while True:

    if getVoltage(analogin) > 0.175:
        pyportal.set_background(laura)
        time.sleep(1)
    else:
        pyportal.set_background(woodsman)
        pyportal.play_file(gottaLight)
        time.sleep(1)
    # Read temperature
    temp = ss.get_temp()
    temp = display_temperature(temp)

    # fill display
    print("filling disp..")
    fill_water(moisture_percentage)
    print("disp filled..")

    print("temp: " + str(temp) + "  moisture: " + str(moisture))

    # Play water level alarms
    if moisture <= SOIL_LEVEL_MIN:
        print("Playing low water level warning...")
        pyportal.play_file(wav_water_low)
    elif moisture >= SOIL_LEVEL_MAX:
        print("Playing high water level warning...")
        pyportal.play_file(wav_water_high)


    if now - initial > (DELAY_PUBLISH * 60):
        try:
            print("Publishing data to Adafruit IO...")
            label_status.text = "Sending to IO..."
            io.publish("moisture", moisture)
            io.publish("temperature", temp)
            print("Published")
            label_status.text = "Data Sent!"

            # reset timer
    time_str = format_str % (hour, minute)
    time_textarea.text = time_str

    if gremlin_since_midnite < mogwai_since_midnite:
        #print("Gremlin time before mogwai time")
        if gremlin_since_midnite <= time_since_midnite < mogwai_since_midnite:
            is_gremlin_time = True
        else:
            is_gremlin_time = False
    else:
        #print("Mogwai time before gremlin time")
        if mogwai_since_midnite <= time_since_midnite < gremlin_since_midnite:
            is_gremlin_time = False
        else:
            is_gremlin_time = True

    if is_gremlin_time != last_gremlin_time:
        if is_gremlin_time:
            print("GREMLIN TIME!")
            pyportal.set_background(gremlin_image)
            pyportal.play_file(gremlin_sound)
        else:
            print("MOGWAI TIME!")
            pyportal.set_background(mogwai_image)
            pyportal.play_file(mogwai_sound)

    last_gremlin_time = is_gremlin_time

    # update every 10 seconds
    #time.sleep(10)
Ejemplo n.º 7
0
# to display it
pyportal = PyPortal(
    url=DATA_SOURCE,
    json_path=DATA_LOCATION,
    status_neopixel=board.NEOPIXEL,
    default_bg=cwd + "/twitter_background.bmp",
    text_font=cwd + "/fonts/Collegiate-50.bdf",
    text_position=(165, 140),
    text_color=0xFFFFFF,
    caption_text="www.twitter.com/" + TWITTER_NAME,
    caption_font=cwd + "/fonts/Collegiate-24.bdf",
    caption_position=(50, 200),
    caption_color=0xFFFFFF,
)

# track the last value so we can play a sound when it updates
last_value = 0

while True:
    try:
        value = pyportal.fetch()
        print("Response is", value)
        if last_value < value:  # ooh it went up!
            print("New follower!")
            pyportal.play_file(cwd + "/coin.wav")  # uncomment make a noise!
        last_value = value
    except (ValueError, RuntimeError) as e:
        print("Some error occured, retrying! -", e)

    time.sleep(60)  # wait a minute before getting again
Ejemplo n.º 8
0
        tempC = adt.temperature
    else:  # No temperature sensor
        tempC = microcontroller.cpu.temperature

    tempF = tempC * 1.8 + 32
    sensor_data.text = 'Touch: {}\nLight: {}\n Temp: {:.0f}°F'.format(
        touch, light, tempF)

    # ------------- Handle Button Press Detection  ------------- #
    if touch:  # Only do this if the screen is touched
        # loop with buttons using enumerate() to number each button group as i
        for i, b in enumerate(buttons):
            if b.contains(touch):  # Test each button to see if it was pressed
                print('button%d pressed' % i)
                if i == 0 and view_live != 1:  # only if view1 is visable
                    pyportal.play_file(soundTab)
                    switch_view(1)
                    while ts.touch_point:
                        pass
                if i == 1 and view_live != 2:  # only if view2 is visable
                    pyportal.play_file(soundTab)
                    switch_view(2)
                    while ts.touch_point:
                        pass
                if i == 2 and view_live != 3:  # only if view3 is visable
                    pyportal.play_file(soundTab)
                    switch_view(3)
                    while ts.touch_point:
                        pass
                if i == 3:
                    pyportal.play_file(soundBeep)
Ejemplo n.º 9
0
 else:
     format_str = format_str+" AM"
 if hour == 0:
     hour = 12
 #  formats date display
 today_str = today
 time_str = format_str % (hour, minute)
 #  checks for weekly alarms
 for i in weekly_alarms:
     w = weekly_alarms.index(i)
     if time_str == weekly_time[w] and today == weekly_day[w]:
         print("trash time")
         alarm = True
         if alarm and not dismissed and not snoozed:
             display.show(alarm_gfx[w])
             pyportal.play_file(alarm_sounds[w])
         mode = w
         print("mode is:", mode)
 #  checks for daily alarms
 for i in alarm_checks:
     a = alarm_checks.index(i)
     if time_str == alarm_checks[a]:
         alarm = True
         if alarm and not dismissed and not snoozed:
             display.show(alarm_gfx[a])
             pyportal.play_file(alarm_sounds[a])
         mode = a
         print(mode)
 #  calls update_time() from openweather_graphics to update
 #  clock display
 gfx.update_time()
Ejemplo n.º 10
0
            outlet.value = False
        text_box(feed1_label, 0,
        '{}/{}/{}'.format(time.localtime().tm_mon, time.localtime().tm_mday,time.localtime().tm_year), 12)
    else:
        pass

    touch = ts.touch_point

    # ------------- Handle Button Press Detection  ------------- #
    if touch:  # Only do this if the screen is touched
        # loop with buttons using enumerate() to number each button group as i
        for i, b in enumerate(buttons):
            if b.contains(touch):  # Test each button to see if it was pressed
                print('button%d pressed' % i)
                if i == 0:
                    pyportal.play_file(soundBeep)
                    # Toggle switch button type
                    if switch_state == 0:
                        switch_state = 1
                        b.label = "ON"
                        b.selected = False
                        pixel.fill(PURPLE)
                        print("Swich ON")
                        if switch_state1 == 1 and time.localtime().tm_hour in range(6, 18):
                            outlet.value = True
                        elif switch_state2 == 1 and time.localtime().tm_hour in range(6, 24):
                            outlet.value = True
                        elif switch_state3 == 1 and time.localtime().tm_hour not in range(2, 6):
                            outlet.value = True
                        else:
                            outlet.value = False
Ejemplo n.º 11
0
    # Setup the file as the bitmap data source
    bitmap = displayio.OnDiskBitmap(bitmap_file)
    # Create a TileGrid to hold the bitmap
    tile_grid = displayio.TileGrid(bitmap,
                                   pixel_shader=getattr(
                                       bitmap, 'pixel_shader',
                                       displayio.ColorConverter()))
    # Create a Group to hold the TileGrid
    group = displayio.Group()
    # Add the TileGrid to the Group
    group.append(tile_grid)
    # Add the Group to the Display
    display.show(group)
    if sound_mode != 0:
        # play a sound file
        pyportal.play_file(vo_sound[10])
    else:
        pyportal.play_file(
            "/vo/pathfnd_silent.wav")  # hack to deal w no mute method

# Loop forever so you can enjoy your image
while True:
    if pyportal.touchscreen.touch_point:
        if sound_mode == 0:
            sound_mode = 1
        else:
            sound_mode = 0

    i = (i + 1) % 11
    pixel.fill(colors[i])
    pixel.show()
Ejemplo n.º 12
0
class Application(object):
    """ documentation """
    def __init__(self):
        self.BACKGROUND_COLOR = 0x443355

        # Setup PyPortal without networking
        self.pyportal = PyPortal(default_bg=self.BACKGROUND_COLOR)

        self.initializeButtons()

        # Set the NeoPixel brightness
        BRIGHTNESS = 0.3

        self.strip_1 = neopixel.NeoPixel(board.D4, 30, brightness=BRIGHTNESS)
        self.strip_2 = neopixel.NeoPixel(board.D3, 30, brightness=BRIGHTNESS)

        # Turn off NeoPixels to start
        self.strip_1.fill(0)
        self.strip_2.fill(0)

        self.mode = 0
        self.mode_change = None

        self.game = MemoryCardsGame()
        cannedData = MemoryCardsGameCannedData()
        self.cards = cannedData.validCardSetCountOf2()
        self.game.setCards(self.cards)
        self.game.startGame()

        self.interval = 5.5
        self.previousTime = time.monotonic()  # Time in seconds since power on

    def coverCard(self, buttonValue):

        buttonIndex = buttonValue - 1

        self.buttonAttributes[buttonIndex]['iconGroup'].pop()
        self.buttonAttributes[buttonIndex]['iconGroup'].append(
            self.cardBackSprite)

    def flipCard(self, buttonIndex, sprintIndex):
        print("card sprite index: ", sprintIndex)
        self.buttonAttributes[buttonIndex]['iconGroup'].pop()
        self.buttonAttributes[buttonIndex]['iconGroup'].append(
            self.cardSprites[sprintIndex])

    def handleButtonPress(self, button):
        print("Touched", button.name)

        buttonValue = int(button.name)

        response = self.selectCard(buttonValue)

        buttonIndex = buttonValue - 1

        sprintIndex = self.cards[buttonIndex].value - 1

        if (response == MemoryCardsGameResponse.GUESS_ONE_ACCEPTED):
            self.guessOneValue = buttonValue
            self.flipCard(buttonIndex, sprintIndex)

        elif response == MemoryCardsGameResponse.GUESS_TWO_ACCEPTED_MATCH:

            self.flipCard(buttonIndex, sprintIndex)
            self.pyportal.play_file('resources/sounds/Coin.wav')

        elif response == MemoryCardsGameResponse.GUESS_TWO_ACCEPTED_MISMATCH:

            self.flipCard(buttonIndex, sprintIndex)

            self.pyportal.play_file("resources/sounds/mismatch.wav")

            self.coverCard(self.guessOneValue)
            self.coverCard(buttonValue)

        elif response == MemoryCardsGameResponse.GUESS_TWO_ACCEPTED_MISMATCH_END_OF_GAME_LOSE:

            print("end of game: loss")

            self.game.resetGame()

            self.pyportal.play_file("resources/sounds/end-of-game.wav")

            for c in range(0, 12):
                cardNumber = c + 1
                self.coverCard(cardNumber)

            self.game.setCards(self.cards)
            self.game.startGame()

        elif response == MemoryCardsGameResponse.GUESS_REJECTED_CARD_ALREADY_REVEALED:

            self.pyportal.play_file('resources/sounds/invalid-guess.wav')

        else:
            message = "unknown response: " + str(response)
            raise Exception(message)

        button.label = self.buttonAttributes[buttonIndex]['label']

        # neopixel updates
        if self.mode == 0:
            self.strip_1.fill(button.fill_color)
        elif self.mode == 1:
            self.strip_2.fill(button.fill_color)
        elif self.mode == 2:
            self.strip_1.fill(button.fill_color)
            self.strip_2.fill(button.fill_color)

    def initializeButtons(self):

        self.icon1Group = displayio.Group()
        self.icon1Group.x = 20
        self.icon1Group.y = 20

        # Button colors
        RED = (255, 0, 0)
        ORANGE = (255, 34, 0)
        YELLOW = (255, 170, 0)
        GREEN = (0, 255, 0)
        CYAN = (0, 255, 255)
        BLUE = (0, 0, 255)
        VIOLET = (153, 0, 255)
        MAGENTA = (255, 0, 51)
        PINK = (255, 51, 119)
        AQUA = (85, 125, 255)
        WHITE = (255, 255, 255)
        OFF = (0, 0, 0)

        self.buttonAttributes = [{
            'label': "1",
            'pos': (10, 10),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "2",
            'pos': (90, 10),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "3",
            'pos': (170, 10),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "4",
            'pos': (250, 10),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "5",
            'pos': (10, 90),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "6",
            'pos': (90, 90),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "7",
            'pos': (170, 90),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "8",
            'pos': (250, 90),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "9",
            'pos': (10, 170),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "10",
            'pos': (90, 170),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "11",
            'pos': (170, 170),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }, {
            'label': "12",
            'pos': (250, 170),
            'size': (60, 60),
            'color': WHITE,
            'iconGroup': None
        }]

        buttonFont = bitmap_font.load_font('/fonts/Arial-16.bdf')
        buttonFont.load_glyphs(b'0123456789CFabcdefghijklmnopqrstuvwxyz:')

        cardBackFile = open('/resources/images/cards/back.bmp', "rb")
        icon = displayio.OnDiskBitmap(cardBackFile)
        self.cardBackSprite = displayio.TileGrid(
            icon, pixel_shader=displayio.ColorConverter(), x=0, y=0)

        cardFile1 = open('/resources/images/cards/1.bmp', "rb")
        cardFileIcon1 = displayio.OnDiskBitmap(cardFile1)
        self.cardSprite1 = displayio.TileGrid(
            cardFileIcon1, pixel_shader=displayio.ColorConverter(), x=0, y=0)

        cardFile2 = open('/resources/images/cards/2.bmp', "rb")
        cardFileIcon2 = displayio.OnDiskBitmap(cardFile2)
        self.cardSprite2 = displayio.TileGrid(
            cardFileIcon2, pixel_shader=displayio.ColorConverter(), x=0, y=0)

        cardFile3 = open('/resources/images/cards/3.bmp', "rb")
        cardFileIcon3 = displayio.OnDiskBitmap(cardFile3)
        self.cardSprite3 = displayio.TileGrid(
            cardFileIcon3, pixel_shader=displayio.ColorConverter(), x=0, y=0)

        cardFile4 = open('/resources/images/cards/4.bmp', "rb")
        cardFileIcon4 = displayio.OnDiskBitmap(cardFile4)
        self.cardSprite4 = displayio.TileGrid(
            cardFileIcon4, pixel_shader=displayio.ColorConverter(), x=0, y=0)

        cardFile5 = open('/resources/images/cards/5.bmp', "rb")
        cardFileIcon5 = displayio.OnDiskBitmap(cardFile5)
        self.cardSprite5 = displayio.TileGrid(
            cardFileIcon5, pixel_shader=displayio.ColorConverter(), x=0, y=0)

        cardFile6 = open('/resources/images/cards/6.bmp', "rb")
        cardFileIcon6 = displayio.OnDiskBitmap(cardFile6)
        self.cardSprite6 = displayio.TileGrid(
            cardFileIcon6, pixel_shader=displayio.ColorConverter(), x=0, y=0)

        self.cardSprites = [
            self.cardSprite1, self.cardSprite2, self.cardSprite3,
            self.cardSprite4, self.cardSprite5, self.cardSprite6
        ]

        self.buttons = []

        for attributes in self.buttonAttributes:
            button = Button(x=attributes['pos'][0],
                            y=attributes['pos'][1],
                            width=attributes['size'][0],
                            height=attributes['size'][1],
                            style=Button.SHADOWROUNDRECT,
                            fill_color=attributes['color'],
                            outline_color=0x222222,
                            name=attributes['label'],
                            label_font=buttonFont)

            iconGroup = displayio.Group()
            iconGroup.x = attributes['pos'][0]
            iconGroup.y = attributes['pos'][1]
            iconGroup.append(self.cardBackSprite)

            attributes['iconGroup'] = iconGroup

            button.group.append(iconGroup)

            self.pyportal.splash.append(button.group)
            self.buttons.append(button)

        self.pyportal.splash.append(self.icon1Group)

    def launch(self):

        while True:

            touch = self.pyportal.touchscreen.touch_point
            if touch:
                for button in self.buttons:
                    if button.contains(touch):
                        self.handleButtonPress(button)

                        break

            #TODO is this needed?
            time.sleep(0.05)

            now = time.monotonic()
            if now - self.previousTime >= 10.333:  # If 10.333 seconds elapses
                print("free memory: ", gc.mem_free())
                self.previousTime = now

    def selectCard(self, cardValue):
        response = None

        if (cardValue == 1):
            response = self.game.selectCard1()
        elif (cardValue == 2):
            response = self.game.selectCard2()
        elif (cardValue == 3):
            response = self.game.selectCard3()
        elif (cardValue == 4):
            response = self.game.selectCard4()
        elif (cardValue == 5):
            response = self.game.selectCard5()
        elif (cardValue == 6):
            response = self.game.selectCard6()
        elif (cardValue == 7):
            response = self.game.selectCard7()
        elif (cardValue == 8):
            response = self.game.selectCard8()
        elif (cardValue == 9):
            response = self.game.selectCard9()
        elif (cardValue == 10):
            response = self.game.selectCard10()
        elif (cardValue == 11):
            response = self.game.selectCard11()
        elif (cardValue == 12):
            response = self.game.selectCard12()
        else:
            print("invalid card value: ")
            print(cardValue)
            raise Exception()

        return response
Ejemplo n.º 13
0
# the current working directory (where this file is)
cwd = ("/" + __file__).rsplit('/', 1)[0]
pyportal = PyPortal(url=DATA_SOURCE,
                    json_path=(DATA_LOCATION),
                    status_neopixel=board.NEOPIXEL,
                    default_bg=cwd + "/lol_background.bmp",
                    text_font=cwd + "/fonts/Collegiate-50.bdf",
                    text_position=(135, 200),
                    text_color=0xffbe33,
                    caption_text=CAPTION,
                    caption_font=cwd + "/fonts/Collegiate-24.bdf",
                    caption_position=(5, 20),
                    caption_color=0xffbe33)

# track the last value so we can play a sound when it updates
last_value = 0

while True:
    try:
        value = pyportal.fetch()
        print("Response is", value)
        if last_value < value:  # ooh it went up!
            print("New level!")
            pyportal.play_file(cwd + "/triode_low_fade.wav")
        last_value = value
    except (ValueError, RuntimeError) as e:
        print("Some error occurred, retrying! -", e)
    #check again in two minutes
    time.sleep(60 * 2)
Ejemplo n.º 14
0
buttons = []
for peg in pegs:
    button = Button(x=peg['pos'][0],
                    y=peg['pos'][1],
                    width=peg['size'][0],
                    height=peg['size'][1],
                    style=Button.RECT,
                    fill_color=None,
                    outline_color=0x5C3C15,
                    name=peg['label'])
    pyportal.splash.append(button.group)
    buttons.append(button)

note_select = None

while True:
    touch = pyportal.touchscreen.touch_point
    if not touch and note_select:
        note_select = False
    if touch:
        for i in range(6):
            tuning = notes[i]
            button = buttons[i]
            if button.contains(touch) and not note_select:
                print("Touched", button.name)
                note_select = True
                for z in range(3):
                    pyportal.play_file(tuning)
    time.sleep(0.1)
Ejemplo n.º 15
0
        # The BME680 returns celsius so we need to convert it to fahrenheit
        tempF = (float(bme680.temperature) * 1.8) + 32
        atextbox.text = "Temperature: {0:.2f}f Humidity: {1:.2f}%".format(
            tempF, bme680.humidity)
        btextbox.text = "Pressure: {0:.2f}hPA Altitude: {1:.2f}".format(
            bme680.pressure, bme680.altitude)
        ctextbox.text = "Gas: {0:.2f}ohm".format(bme680.gas)

        #A timer for our GAS Sensor that needs 48 hours to be ready
        if remaining <= 0:
            while True:
                dtextbox.text = "Gas Sensor Burned In"
                etextbox.text = "Your BME680 is ready"
                #Make some noise to get your attention
                pyportal.play_file("/pyportal_startup.wav",
                                   wait_to_finish=True)
        else:
            dtextbox.text = "{} days, {} hours".format(days_remaining,
                                                       hours_remaining)
            etextbox.text = "{} minutes and {} seconds".format(
                mins_remaining, secs_remaining)

        #Reset AFK timer on touch
        if touch:
            lastTick = time.monotonic()
            isAFK = False
            print("Touched!")

        #Not burn out our screen while we burn in the BME680
        if isAFK:
            display.brightness = 0
Ejemplo n.º 16
0
    if keyboard_active:
        point = touch_screen.touch_point

        if point:
            # append each touch connection to a list
            point_list.append(point)

            # after three trouch detections have occured.
            if len(point_list) == 3:
                # discard the first touch detection and average the other
                # two get the x,y of the touch
                x = int((point_list[1][0] + point_list[2][0]) / 2)
                y = int((point_list[1][1] + point_list[2][1]) / 2)
                log("(" + str(x) + "/" + str(y) + ") pressed")

                pyportal.play_file(BEEP_SOUND_FILE)

                button_controller.check_and_send_shortcut_to_host(x, y)

                if dim_button.contains((x, y, 65000)):
                    print("dim button pressed")

                    if display_on:
                        pyportal.set_backlight(0)
                    else:
                        pyportal.set_backlight(0.55)

                    display_on = not display_on

                # clear list for next detection
                point_list = []