2016-03-25 16:47:20 -07:00
|
|
|
# Create Image
|
|
|
|
|
2016-06-17 13:42:01 -07:00
|
|
|
Make an [image](/reference/images/image) (picture) for the micro:bit
|
|
|
|
[LED screen](/device/screen).
|
2016-03-25 16:47:20 -07:00
|
|
|
|
|
|
|
```sig
|
|
|
|
images.createImage(`
|
|
|
|
. . # . .
|
|
|
|
. # # # .
|
|
|
|
# # # # #
|
|
|
|
. # # # .
|
|
|
|
. . # . .
|
|
|
|
`)
|
|
|
|
```
|
|
|
|
|
2016-07-18 15:18:40 -07:00
|
|
|
### Parameters
|
|
|
|
|
|
|
|
* ``leds`` is a [string](/reference/types/string) that says which LEDs
|
|
|
|
on the screen should be on and which should be off.
|
|
|
|
|
2016-06-17 13:42:01 -07: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
|
2016-06-17 15:00:24 -07:00
|
|
|
program will show a picture of the arrow upside-down.
|
2016-06-17 13:42:01 -07:00
|
|
|
|
|
|
|
```blocks
|
|
|
|
input.onButtonPressed(Button.A, () => {
|
|
|
|
images.createImage(`
|
|
|
|
. . # . .
|
|
|
|
. # # # .
|
|
|
|
# . # . #
|
|
|
|
. . # . .
|
|
|
|
. . # . .
|
|
|
|
`).showImage(0);
|
|
|
|
});
|
|
|
|
input.onButtonPressed(Button.B, () => {
|
|
|
|
images.createImage(`
|
|
|
|
. . # . .
|
|
|
|
. . # . .
|
|
|
|
# . # . #
|
|
|
|
. # # # .
|
|
|
|
. . # . .
|
|
|
|
`).showImage(0);
|
|
|
|
});
|
2016-03-25 16:47:20 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
### See also
|
|
|
|
|
2016-06-19 05:14:46 -07:00
|
|
|
[Getting Started](/getting-started), [image](/reference/images/image),
|
2016-06-17 15:00:24 -07:00
|
|
|
[create big image](/reference/images/create-big-image),
|
2016-06-17 16:20:17 -07:00
|
|
|
[show image](/reference/images/show-image),
|
|
|
|
[scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)
|
2016-06-17 15:00:24 -07:00
|
|
|
|