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

69 lines
1.4 KiB
Markdown
Raw Normal View History

2017-01-02 03:52:22 +01:00
# Getting started
## Step 1
2017-01-02 03:52:22 +01:00
Welcome! Place the ``||basic:show string||`` block in the ``||basic:on start||`` slot. Replace the ``"Hello"`` text with your name. Did you see it scroll?
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
2017-01-02 03:52:22 +01:00
Connect a USB cable to the @boardname@ and click ``|Download|``. Save the program to the **@drivename@** drive. This transfers your code to the @boardname@!
2017-01-02 03:52:22 +01:00
## Step 3
2017-01-02 03:52:22 +01:00
Well, the text stopped. Place the ``||basic:show string||`` block in the ``||input: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
## Step 4
2017-01-02 03:52:22 +01:00
Click ``|Download|`` to save and transfer your code again, then press button **A** to scroll your text.
2017-01-06 13:32:53 +01:00
## Step 5
2017-01-06 13:32:53 +01:00
Place some blocks to display a smiley when button **B** is pressed.
2017-03-30 23:14:39 +02:00
###
2017-03-30 23:14:39 +02:00
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
})
```
## Step 6
2017-01-02 03:52:22 +01:00
Place the ``||basic:show number||`` and ``||Math:pick random||`` blocks
in an ``||input:on shake||`` slot to build a dice.
2017-03-30 23:14:39 +02:00
###
2017-03-30 23:14:39 +02:00
When the @boardname@ is shaken, a random number between ``0`` and ``6`` is displayed
on the screen.
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-09-10 10:34:18 +02:00
Well done! You've completed your first Microsoft MakeCode activity.