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

68 lines
1.0 KiB
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("Hi!")
2017-01-02 03:52:22 +01:00
```
### Step 2
2017-01-06 13:32:53 +01:00
Transfer your code in your @boardname@! Click the **Download** button
and follow the instructions.
ANIMATEDGIF
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("Hi!")
});
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
2017-01-06 13:32:53 +01:00
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!
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.
Download your code and try it!
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
```