pxt-calliope/docs/reference/images/create-big-image.md
2016-06-17 16:20:17 -07:00

1.4 KiB

Create Big Image

Make a big image (picture) for the micro:bit LED screen. The big image made of two squares. Each of the squares is five LEDs on a side, like a regular image.

images.createBigImage(`
    . . # . .   . . # . .
    . # # # .   . . # . .
    # . # . #   # . # . #
    . . # . .   . # # # .
    . . # . .   . . # . .
    `);

Example: Flip-flopping arrow

This program makes a big image with a picture of an arrow pointing up, and an arrow pointing down. If you press button A, the program will show the arrow pointing up, which starts 0 LEDs from the left in the big image. If you press button B, the program will show the arrow pointing down, which starts 5 LEDs from the left.

let arrows = images.createBigImage(`
    . . # . .   . . # . .
    . # # # .   . . # . .
    # . # . #   # . # . #
    . . # . .   . # # # .
    . . # . .   . . # . .
    `);
input.onButtonPressed(Button.A, () => {
    arrows.showImage(0);
});
input.onButtonPressed(Button.B, () => {
    arrows.showImage(5);
});

See also

Getting Started, image, create image, show image, scroll image, show animation