pxt-calliope/docs/reference/images/icon-image.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

30 lines
849 B
Markdown

# icon Image
Create an icon [image](/reference/images/image) for the [LED screen](/device/screen).
```sig
images.iconImage(IconNames.Heart);
```
There are lots of pre-made icon images you can use to display on the [LED screen](/device/screen) of the @boardname@. You choose an icon by its name.
## Parameters
* **i**: the icon name of the image you want to show on the [LED screen](/device/screen). You pick an icon image such as: `IconNames.Heart`.
## Example
Show a happy face when button A is pressed or a sad face when button B is pressed.
```blocks
let iamHappy = images.iconImage(IconNames.Happy)
let iamSad = images.iconImage(IconNames.Sad)
input.onButtonEvent(Button.A, input.buttonEventClick(), () => {
iamHappy.showImage(0);
});
input.onButtonEvent(Button.B, input.buttonEventClick(), () => {
iamSad.showImage(0);
});
```