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

69 lines
1.2 KiB
Markdown
Raw Normal View History

2017-01-02 03:52:22 +01:00
# Getting started
### Step 1
2017-03-30 23:14:39 +02:00
Welcome! Place the ``||show string||`` block in the ``||on start||`` slot to scroll your name.
2017-01-02 03:52:22 +01:00
2017-01-06 13:32:53 +01:00
```blocks
2017-03-30 23:14:39 +02:00
basic.showString("Micro!")
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-03-30 23:14:39 +02:00
The text stopped. Place the ``||show string||`` block in the ``||on button pressed||``
slot to scroll your name 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, () => {
2017-03-30 23:14:39 +02:00
basic.showString("Micro!")
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
2017-03-30 23:14:39 +02:00
then press button **A** to scroll your text.
2017-01-06 13:32:53 +01:00
### Step 5
2017-03-30 23:14:39 +02:00
Place blocks to display a smiley when button **B** is pressed.
####
Use the dropdown to find ``B``!
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-03-30 23:14:39 +02:00
Place the ``||show number||`` and ``||pick random||`` blocks
in the ``||on shake||`` slot to build a dice.
####
When the @boardname@ is shaken, the random number between ``0`` and ``6`` will be displayed
on the scren.
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, () => {
2017-03-30 23:14:39 +02:00
basic.showNumber(Math.random(7))
2017-01-03 07:14:40 +01:00
})
2017-01-02 03:52:22 +01:00
```
### Step 7
2017-03-30 23:14:39 +02:00
Well done! You have complete this activity.