2017-01-02 03:52:22 +01:00
# Getting started
2017-09-07 22:42:08 +02:00
## Step 1
2017-01-02 03:52:22 +01:00
2018-08-17 16:58:45 +02: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 in the simulator?
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
```
2017-09-07 22:42:08 +02:00
## Step 2
2017-01-02 03:52:22 +01:00
2018-08-17 16:58:45 +02:00
Well, the text stopped scrolling. 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
2018-06-01 20:49:48 +02:00
```blocks
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
2018-08-17 16:58:45 +02:00
## Step 3
2017-01-06 13:32:53 +01:00
2017-08-18 16:43:50 +02:00
Place some blocks to display a smiley when button **B** is pressed.
2017-03-30 23:14:39 +02:00
2017-01-17 20:37:20 +01:00
Use the dropdown to find ``B``!
2017-01-02 03:52:22 +01:00
2018-06-01 20:49:48 +02:00
```blocks
2017-01-04 19:06:47 +01:00
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
})
```
2018-08-17 16:58:45 +02:00
## Step 4
2017-01-02 03:52:22 +01:00
2018-08-17 16:58:45 +02:00
Place the ``||basic:show number||`` and ``||Math:pick random||`` blocks in an ``||input:on shake||`` block to build a dice.
2017-03-30 23:14:39 +02:00
2018-08-17 16:58:45 +02:00
```blocks
input.onGesture(Gesture.Shake, () => {
basic.showNumber(Math.randomRange(0, 10))
})
```
2017-03-30 23:14:39 +02:00
2018-08-17 16:58:45 +02:00
## Step 5
A typical dice shows values from `1` to `6` . So, in ``||Math:pick random||``, don't forget to choose the right minimum and maximum values!
2017-01-02 03:52:22 +01:00
2018-06-01 20:49:48 +02:00
```blocks
2017-01-06 13:32:53 +01:00
input.onGesture(Gesture.Shake, () => {
2018-08-02 20:49:16 +02:00
basic.showNumber(Math.randomRange(1, 6))
2017-01-03 07:14:40 +01:00
})
2017-01-02 03:52:22 +01:00
```
2017-01-17 20:37:20 +01:00
2018-08-17 16:58:45 +02:00
## Step 6
2018-08-21 18:00:18 +02:00
If you have a @boardname @, connect a USB cable to it and click ``|Download|``. Save the program to the ** @drivename @** drive. This transfers your code to the @boardname @!
2018-08-17 16:58:45 +02:00
2017-09-07 22:42:08 +02:00
## Step 7
2017-01-17 20:37:20 +01:00
2018-08-17 16:58:45 +02:00
On the @boardname @, press button **A** to scroll your text. Press button **B** to show a smiley. Shake the @boardname @ and see which number is chosen.
2017-09-09 20:01:27 +02:00
2018-08-17 16:58:45 +02:00
## Step 8
Well done! You've completed your first Microsoft MakeCode activity.