Skip to content

Improve button-usage documentation #15

@jose1711

Description

@jose1711

It would be helpful to explicitly highlight the difference between configuring a pin for BUTTON_A versus the BOOT (USER_SW) button.

BUTTON_A requires an internal pull-up resistor, while the BOOT / USER_SW button uses an internal pull-down resistor. This affects both how the pin must be configured and how the button state should be interpreted.

# BUTTON_A uses PULL_UP
>>> from machine import Pin
>>> button_a = Pin("BUTTON_A", Pin.IN, Pin.PULL_UP)
>>> button_a.value()  # button pressed
0
>>> button_a.value()  # button released
1

# BOOT / USER_SW uses the default PULL_DOWN
>>> user_sw = Pin("USER_SW", Pin.IN) # defaults to PULL_DOWN
>>> user_sw.value()  # button pressed
0
>>> user_sw.value()  # button released
1

Also with Button class, BOOT button does not seem to properly detect the button press.

>>> from pimoroni import Button
>>> user_sw = Button("USER_SW")
>>> user_sw.read()  # always returns False, BUTTON_A works as expected

The above has been tested on Plasma 2350W with MicroPython feature/pico2_w_2025_3_11 (2025-03-31).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions