pxt-calliope/docs/reference/input/on-logo-event.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

39 lines
1.1 KiB
Markdown

# on Logo Event
Run some code in your program when the @boardname@ logo is pressed, touched, or released.
```sig
input.onLogoEvent(TouchButtonEvent.Pressed, function () {})
```
### ~ reminder
![works with micro:bit V2 only image](/static/v2/v2-only.png)
This block requires the [micro:bit V2](/device/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. The logo will detect your touch. You can have code inside an event that will run when the logo is pressed.
## Parameters
* **action**: the logo event to run your code for. The events are ``released``, ``pressed``, ``touched`` or ``long pressed``.
## Example
Show a message on the LEDs when the @boardname@ logo is pressed.
```blocks
input.onLogoEvent(TouchButtonEvent.Pressed, function () {
basic.showString("I was pressed!")
})
```
## See also
[micro:bit V2](/device/v2),
[logo is pressed](/reference/input/logo-is-pressed),
[on pin pressed](/reference/input/on-logo-released),
[touch set mode](/referene/inpu/touch-set-mode)