is Pressed

Check if a button is being pressed or not.



If your board has pins or pads that work as touch inputs, then your code can use them just like buttons. Instead of saying button A or button B as the input source, use a pin name like pin A1.

if (input.pinA1.isPressed()) {
    console.log("Hey, I feel pressed.");

Read about touch sensors and using the pins as touch buttons.


  • a boolean: true if the button is pressed, false if the button is not pressed


Log a message when button A is pressed.

forever(function() {
    if (input.buttonA.isPressed()) {
        console.log("Button A is pressed")

See also

was pressed, on event

Touch sensors