pxt-calliope/docs/reference/input/logo-is-pressed.md
Juri Wolf 5f7a8e5301
Updates for V4 (#197)
* update yotta defaults for 16kb devices

* refactor deprecated blocks

* updates for button events

* update button events

* update refference

* update docs

* update docs

* update button event blocks

* update docs

* update block id
2022-08-10 09:36:19 -07:00

1.1 KiB

logo Is Pressed

Check if the @boardname@ logo is currently being pressed.

input.logoIsPressed()

~ reminder

works with micro:bit V2 only image

This block requires the micro:bit V2 hardware. If you use this block with a micro:bit v1 board, you will see the 927 error code on the screen.

~

The logo on the @boardname@ works just like a touch pin. You can check the whether or not the logo is currently being pressed. You use the boolean value for the status of the logo press to make a logical decision in your program.

Returns

  • a boolean value that is true if the logo is pressed, false if the logo is not pressed.

Example

Show an icon on the LEDs while the logo is pressed.

basic.forever(function () {
    if (input.logoIsPressed()) {
        basic.showIcon(IconNames.Diamond)
    } else {
        basic.clearScreen()
    }
})

See also

micro:bit V2, on logo event, pin is pressed, touch set mode