Skip to content

Commit 8faa428

Browse files
authored
Merge pull request #1003 from pimoroni/patch/display-menu-examples
Pico Display 2.x: Fixed button function
2 parents 871399a + f1c361b commit 8faa428

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

micropython/examples/pico_display/scroll_menu_h.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Note: This example is intended for use on the Pico Display 2.0 and Pico Display 2.8
2+
# and will not display correctly on the smaller Pico Display due to the difference in resolution.
3+
14
# A scrolling menu example
25
# Use B and Y buttons to navigate LEFT and RIGHT
36
# Press A to select a character. Selected characters are shown at the top of the display.
@@ -8,10 +11,10 @@
811
from pimoroni import RGBLED
912
from machine import Pin
1013

11-
button_a = Pin(12, Pin.IN)
12-
button_b = Pin(13, Pin.IN)
13-
button_x = Pin(14, Pin.IN)
14-
button_y = Pin(15, Pin.IN)
14+
button_a = Pin(12, Pin.IN, Pin.PULL_UP)
15+
button_b = Pin(13, Pin.IN, Pin.PULL_UP)
16+
button_x = Pin(14, Pin.IN, Pin.PULL_UP)
17+
button_y = Pin(15, Pin.IN, Pin.PULL_UP)
1518

1619
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_RGB565, rotate=0)
1720
display.set_backlight(0.8)

micropython/examples/pico_display/scroll_menu_v.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Note: This example is intended for use on the Pico Display 2.0 and Pico Display 2.8
2+
# and will not display correctly on the smaller Pico Display due to the difference in resolution.
3+
14
# A scrolling menu example
25
# Use X and Y buttons to navigate up and down the menu
36
# Press A to select a character. Selected characters are shown at the bottom of the display.
@@ -8,10 +11,10 @@
811
from pimoroni import RGBLED
912
from machine import Pin
1013

11-
button_a = Pin(12, Pin.IN)
12-
button_b = Pin(13, Pin.IN)
13-
button_x = Pin(14, Pin.IN)
14-
button_y = Pin(15, Pin.IN)
14+
button_a = Pin(12, Pin.IN, Pin.PULL_UP)
15+
button_b = Pin(13, Pin.IN, Pin.PULL_UP)
16+
button_x = Pin(14, Pin.IN, Pin.PULL_UP)
17+
button_y = Pin(15, Pin.IN, Pin.PULL_UP)
1518

1619
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_RGB565, rotate=0)
1720
display.set_backlight(0.8)

0 commit comments

Comments
 (0)