() Button Pressed?
<( v) button pressed?::microbit>
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.

Example Uses

  • Displaying when a specific button is pressed
if <(A v) button pressed? :: microbit> then
 say [Button pressed!]
end
  • Movement based on pressing certain buttons
if <(A v) button pressed? :: microbit> then
 move (10) steps
end
if <(B v) button pressed? :: microbit> then
 move (-10) steps
end