Merge pull request #1003 from pimoroni/patch/display-menu-examples

Pico Display 2.x: Fixed button function
pull/1016/head
Hel Gibbons 2024-10-02 14:10:16 +01:00 zatwierdzone przez GitHub
commit 8faa428a5b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 14 dodań i 8 usunięć

Wyświetl plik

@ -1,3 +1,6 @@
# Note: This example is intended for use on the Pico Display 2.0 and Pico Display 2.8
# and will not display correctly on the smaller Pico Display due to the difference in resolution.
# A scrolling menu example
# Use B and Y buttons to navigate LEFT and RIGHT
# Press A to select a character. Selected characters are shown at the top of the display.
@ -8,10 +11,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)

Wyświetl plik

@ -1,3 +1,6 @@
# Note: This example is intended for use on the Pico Display 2.0 and Pico Display 2.8
# and will not display correctly on the smaller Pico Display due to the difference in resolution.
# A scrolling menu example
# Use X and Y buttons to navigate up and down the menu
# Press A to select a character. Selected characters are shown at the bottom of the display.
@ -8,10 +11,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)