2016-03-26 00:47:20 +01:00
|
|
|
# Create Image
|
|
|
|
|
2016-06-17 22:42:01 +02:00
|
|
|
Make an [image](/reference/images/image) (picture) for the micro:bit
|
|
|
|
[LED screen](/device/screen).
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```sig
|
|
|
|
images.createImage(`
|
|
|
|
. . # . .
|
|
|
|
. # # # .
|
|
|
|
# # # # #
|
|
|
|
. # # # .
|
|
|
|
. . # . .
|
|
|
|
`)
|
|
|
|
```
|
|
|
|
|
2016-06-17 22:42:01 +02:00
|
|
|
### Example: Flip-flopping arrow
|
|
|
|
|
|
|
|
If you press button `A`, this program will make a picture of an
|
|
|
|
arrow and show it on the LED screen. If you press button `B`, the
|
|
|
|
program will show a picture of the button upside-down.
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
input.onButtonPressed(Button.A, () => {
|
|
|
|
images.createImage(`
|
|
|
|
. . # . .
|
|
|
|
. # # # .
|
|
|
|
# . # . #
|
|
|
|
. . # . .
|
|
|
|
. . # . .
|
|
|
|
`).showImage(0);
|
|
|
|
});
|
|
|
|
input.onButtonPressed(Button.B, () => {
|
|
|
|
images.createImage(`
|
|
|
|
. . # . .
|
|
|
|
. . # . .
|
|
|
|
# . # . #
|
|
|
|
. # # # .
|
|
|
|
. . # . .
|
|
|
|
`).showImage(0);
|
|
|
|
});
|
2016-03-26 00:47:20 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
### See also
|
|
|
|
|
2016-06-17 22:42:01 +02:00
|
|
|
[Getting Started](/reference/getting-started), [image](/reference/images/image), [show image](/reference/image/show-image),
|
|
|
|
[scroll image](/reference/image/scroll-image), [show animation](/reference/basic/show-animation)
|