From 61ca10eacae4ab4e6e154764d1042a0643c1c0b2 Mon Sep 17 00:00:00 2001 From: thirdr Date: Thu, 26 Sep 2024 15:53:03 +0100 Subject: [PATCH] Pico Display 2.x: Fixed button function --- micropython/examples/pico_display/scroll_menu_h.py | 8 ++++---- micropython/examples/pico_display/scroll_menu_v.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/micropython/examples/pico_display/scroll_menu_h.py b/micropython/examples/pico_display/scroll_menu_h.py index da98c03f..9371719b 100644 --- a/micropython/examples/pico_display/scroll_menu_h.py +++ b/micropython/examples/pico_display/scroll_menu_h.py @@ -8,10 +8,10 @@ from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2, PEN_RGB565 from pimoroni import RGBLED from machine import Pin -button_a = Pin(12, Pin.IN) -button_b = Pin(13, Pin.IN) -button_x = Pin(14, Pin.IN) -button_y = Pin(15, Pin.IN) +button_a = Pin(12, Pin.IN, Pin.PULL_UP) +button_b = Pin(13, Pin.IN, Pin.PULL_UP) +button_x = Pin(14, Pin.IN, Pin.PULL_UP) +button_y = Pin(15, Pin.IN, Pin.PULL_UP) display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_RGB565, rotate=0) display.set_backlight(0.8) diff --git a/micropython/examples/pico_display/scroll_menu_v.py b/micropython/examples/pico_display/scroll_menu_v.py index f73ca5f5..74ba17ee 100644 --- a/micropython/examples/pico_display/scroll_menu_v.py +++ b/micropython/examples/pico_display/scroll_menu_v.py @@ -8,10 +8,10 @@ from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2, PEN_RGB565 from pimoroni import RGBLED from machine import Pin -button_a = Pin(12, Pin.IN) -button_b = Pin(13, Pin.IN) -button_x = Pin(14, Pin.IN) -button_y = Pin(15, Pin.IN) +button_a = Pin(12, Pin.IN, Pin.PULL_UP) +button_b = Pin(13, Pin.IN, Pin.PULL_UP) +button_x = Pin(14, Pin.IN, Pin.PULL_UP) +button_y = Pin(15, Pin.IN, Pin.PULL_UP) display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_RGB565, rotate=0) display.set_backlight(0.8)