pxt-calliope/docs/tutorials/getting-started.md

62 lines
972 B
Markdown
Raw Normal View History

2017-01-02 03:52:22 +01:00
# Getting started
### Step 1
2017-01-06 13:32:53 +01:00
Place blocks in the workspace to scroll text on the screen.
2017-01-02 03:52:22 +01:00
2017-01-06 13:32:53 +01:00
```blocks
basic.showString("Hello!")
2017-01-02 03:52:22 +01:00
```
### Step 2
Click ``|Download|`` to transfer your code in your @boardname@!
2017-01-02 03:52:22 +01:00
### Step 3
2017-01-06 13:32:53 +01:00
Great, the text scrolled! But then it stopped.
Let's make it scroll when button **A** is pressed.
2017-01-02 03:52:22 +01:00
2017-01-04 19:06:47 +01:00
```block
2017-01-06 13:32:53 +01:00
input.onButtonPressed(Button.A, () => {
basic.showString("Hello!")
2017-01-06 13:32:53 +01:00
});
2017-01-02 03:52:22 +01:00
```
2017-01-06 13:32:53 +01:00
2017-01-02 03:52:22 +01:00
### Step 4
Click ``|Download|`` to transfer your code
and press **A** to scroll your text.
2017-01-06 13:32:53 +01:00
### Step 5
Place more blocks to display a smiley when button **B** is pressed.
2017-01-02 03:52:22 +01:00
2017-01-04 19:06:47 +01:00
```block
input.onButtonPressed(Button.B, () => {
basic.showLeds(`
2017-01-06 13:32:53 +01:00
# # . # #
# # . # #
2017-01-04 19:06:47 +01:00
. . . . .
2017-01-06 13:32:53 +01:00
# . . . #
. # # # .
2017-01-04 19:06:47 +01:00
`)
2017-01-03 07:14:40 +01:00
})
```
2017-01-06 13:32:53 +01:00
### Step 6
2017-01-02 03:52:22 +01:00
2017-01-06 13:32:53 +01:00
Drag more blocks to display a frownie when @boardname@ is shaken.
2017-01-02 03:52:22 +01:00
2017-01-04 19:06:47 +01:00
```block
2017-01-06 13:32:53 +01:00
input.onGesture(Gesture.Shake, () => {
basic.showLeds(`
# # . # #
# # . # #
. . . . .
. # # # .
# . . . #
`)
2017-01-03 07:14:40 +01:00
})
2017-01-02 03:52:22 +01:00
```