() Button Pressed?
( v) button pressed?
Category micro:bit
Type Boolean

The () button pressed? block is a boolean block and a micro:bit block. Its options are "A", "B", and "any". The block returns whether or not the specified button is being pressed on the micro:bit unit. The option selected in the dropdown can be A, B, or any.

Example Uses

  • Displaying when a specific button is pressed
if <(any v) button pressed?> then
 say [Button pressed!]
end
  • Movement based on pressing certain buttons
if <(A v) button pressed?> then
 move (10) steps
end
if <(B v) button pressed?> then
 move (-10) steps
end
Cookies help us deliver our services. By using our services, you agree to our use of cookies.