pxt-calliope/docs/reference/images/create-big-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

1.5 KiB

Create Big Image

Make a big image (picture) for the @boardname@ 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(`
    . . # . .   . . # . .
    . # # # .   . . # . .
    # . # . #   # . # . #
    . . # . .   . # # # .
    . . # . .   . . # . .
    `);

Parameters

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

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.onButtonEvent(Button.A, input.buttonEventClick(), () => {
    arrows.showImage(0);
});
input.onButtonEvent(Button.B, input.buttonEventClick(), () => {
    arrows.showImage(5);
});

See also

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