pxt-calliope/docs/tutorials/getting-started.md
2017-01-06 04:32:53 -08:00

1.0 KiB

Getting started

Step 1

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

basic.showString("Hi!")

Step 2

Transfer your code in your @boardname@! Click the Download button and follow the instructions.

ANIMATEDGIF

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("Hi!")
});

Step 4

Transfer your code in your @boardname@ and try pressing A.

ANIMATEDGIF

Step 5

Place more blocks to display a smiley when button B is pressed. Download your code and try it!

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

Step 6

Drag more blocks to display a frownie when @boardname@ is shaken. Download your code and try it!

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