pxt-calliope/docs/tutorials/getting-started.md
2017-01-06 14:41:33 -08:00

972 B

Getting started

Step 1

Place blocks in the workspace to scroll text on the screen.

basic.showString("Hello!")

Step 2

Click |Download| to transfer your code in your @boardname@!

Step 3

Great, the text scrolled! But then it stopped. Let's make it scroll when button A is pressed.

input.onButtonPressed(Button.A, () => {
    basic.showString("Hello!")
});

Step 4

Click |Download| to transfer your code and press A to scroll your text.

Step 5

Place more blocks to display a smiley when button B is pressed.

input.onButtonPressed(Button.B, () => {
    basic.showLeds(`
    # # . # #
    # # . # #
    . . . . .
    # . . . #
    . # # # .
    `)
})

Step 6

Drag more blocks to display a frownie when @boardname@ is shaken.

input.onGesture(Gesture.Shake, () => {
    basic.showLeds(`
    # # . # #
    # # . # #
    . . . . .
    . # # # .
    # . . . #
    `)
})