There are two buttons on the board, called button_a and button_b.
A Button instance representing the left button.
A Button instance representing the right button.
Represents a button.
This class is not actually available to the user, it is only used by the two button instances, which are provided already initialized.
Returns True if the specified button button is pressed, and False otherwise.
Returns True or False to indicate if the button was pressed since the device started or the last time this method was called.
Here is an example written in python using the Mu editor
from microbit import * while True: if button_a.is_pressed(): display.show("A") elif button_b.is_pressed(): display.show("B") else: display.clear()
Here is an example using the Block Editor