pxt-calliope/docs/reference/images/create-image.md
2020-02-20 17:00:11 +01:00

1.2 KiB

Create Image

Make an image (picture) for the @boardname@ LED screen.

images.createImage(`
. . # . .
. # # # .
# # # # #
. # # # .
. . # . .
`)

Parameters

  • leds is a string that says which LEDs on the screen should be on and which should be off.

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 arrow upside-down.

input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
    images.createImage(`
        . . # . .
        . # # # .
        # . # . #
        . . # . .
        . . # . .
        `).showImage(0);
});
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
    images.createImage(`
        . . # . .
        . . # . .
        # . # . #
        . # # # .
        . . # . .
        `).showImage(0);
});

See also

image, create big image, show image, scroll image, show animation