Modify tutorials for single download step (#1093)

* Modify tutorials for single dl step

* Some more fixes

* coin flip typer
This commit is contained in:
Galen Nickel 2018-08-17 07:58:45 -07:00 committed by Guillaume Jenkins
parent 0919a4e886
commit f4aa25e2bd
5 changed files with 54 additions and 56 deletions

View File

@ -4,7 +4,7 @@ Let's create a coin flipping program to simulate a real coin toss. We'll use ico
## Step 1
Get an ``||input:on button A pressed||`` block from the ``||input:Input||`` drawer in the toolbox. The coin flip code we add will run when button **A** is pressed.
Get an ``||input:on button A pressed||`` block from the ``||input:Input||`` drawer in the toolbox. We'll put our coin flipping code in here.
```blocks
input.onButtonPressed(Button.A, () => {
@ -41,11 +41,11 @@ input.onButtonPressed(Button.A, () => {
## Step 4
Click ``|Download|`` to transfer your code into your @boardname@. Press button **A** to "toss a coin" and see the result.
Press button **A** in the simulator to try our coin toss code.
## Step 5
You can animate the coin toss to add the feeling of suspense. Place different ``||basic:show icon||`` blocks before the ``||logic:if||`` to show that the coin is flipping before the result appears.
You can animate the coin toss to add the feeling of suspense. Place different ``||basic:show icon||`` blocks before the ``||logic:if||`` to show that the coin is flipping.
```blocks
input.onButtonPressed(Button.A, () => {
@ -63,4 +63,8 @@ input.onButtonPressed(Button.A, () => {
## Step 6
Click ``|Download|`` to transfer your code to your @boardname@ again and press button **A** for a flip. Test your luck and guess ``heads`` or ``tails`` before the toss is over!
If your have a @boardname@, connect it to USB and click ``|Download|`` to transfer your code.
## Step 7
Press button **A** for a flip. Test your luck and guess ``heads`` or ``tails`` before the toss is over!

View File

@ -16,11 +16,7 @@ basic.showLeds(`
## Step 2
Click ``|Download|`` to transfer your code in your @boardname@!
## Step 3
Place another ``||basic:show leds||`` block under the heart to make it blink.
Place another ``||basic:show leds||`` block under the heart to make it blink. Check in the simulator to see the heart blink.
```blocks
basic.showLeds(`
@ -37,7 +33,7 @@ basic.showLeds(`
. . # . .`);
```
## Step 4
## Step 3
Move the blocks inside the ``||basic:forever||`` to repeat the animation.
@ -59,11 +55,7 @@ basic.forever(() => {
})
```
## Step 5
Click ``|Download|`` to transfer your code in your @boardname@ and watch the hearts flash!
## Step 6
## Step 4
Place more ``||basic:show leds||`` blocks to create your own animation.
@ -91,6 +83,6 @@ basic.forever(() => {
})
```
## Step 7
## Step 5
Click ``|Download|`` to transfer your code in your @boardname@!
If you have a @boardname@ connected, click ``|Download|`` to transfer your code and watch the hearts flash!

View File

@ -4,33 +4,37 @@ Make a love meter, how sweet! The @boardname@ is feeling the love, then sometime
## Step 1
Let's build a **LOVE METER** machine. Place a ``||input:on pin pressed||`` block to run code when pin ``P0`` is pressed.
Let's build a **LOVE METER** machine. Place a ``||input:on pin pressed||`` block to run code when pin **0** is pressed. Use ``P0`` from the list of pin inputs.
```blocks
input.onPinPressed(TouchPin.P0, () => {
});
```
## Step 2
Using ``||basic:show number||`` and ``||Math:pick random||`` blocks, show a random number from 0 to 100 when pin ``P0`` is pressed.
Using ``||basic:show number||`` and ``||Math:pick random||`` blocks, show a random number from 0 to 100 when pin **0** is pressed.
```blocks
input.onPinPressed(TouchPin.P0, () => {
basic.showNumber(Math.randomRange(0, 101));
basic.showNumber(Math.randomRange(0, 100));
});
```
## Step 3
Click on pin **0** in the simulator and see which number is chosen.
## Step 4
Show ``"LOVE METER"`` on the screen when the @boardname@ starts.
```blocks
basic.showString("LOVE METER");
input.onPinPressed(TouchPin.P0, () => {
basic.showNumber(Math.randomRange(0, 101));
basic.showNumber(Math.randomRange(0, 100));
});
```
## Step 4
## Step 5
Click ``|Download|`` to transfer your code in your @boardname@. Hold the ``GND`` pin with other hand and press pin ``P0`` with the other hand to trigger this code.
Click ``|Download|`` to transfer your code in your @boardname@. Hold the **GND** pin with one hand and press pin **0** with the other hand to trigger this code.

View File

@ -11,7 +11,7 @@ input.onButtonPressed(Button.A, () => {
## Step 2
Place a ``||basic:show leds||`` block inside ``||input:on button pressed||`` to display a smiley on the screen.
Place a ``||basic:show leds||`` block inside ``||input:on button pressed||`` to display a smiley on the screen. Press the **A** button in the simulator to see the smiley.
```blocks
input.onButtonPressed(Button.A, () => {
@ -27,10 +27,6 @@ input.onButtonPressed(Button.A, () => {
## Step 3
Click ``|Download|`` to transfer your code in your @boardname@ and try pressing button **A**.
## Step 4
Add ``||input:on button pressed||`` and ``||basic:show leds||`` blocks to display a frowney when button **B** is pressed.
```blocks
@ -45,13 +41,9 @@ input.onButtonPressed(Button.B, () => {
});
```
## Step 5
## Step 4
Click ``|Download|`` to transfer your code in your @boardname@ and try pressing button A or B.
## Step 6
Add a secret mode where ``A`` and ``B`` are pressed together. In that case, add multiple ``||basic:show leds||`` blocks to create an animation...
Add a secret mode that happens when **A** and **B** are pressed together. In that case, add multiple ``||basic:show leds||`` blocks to create an animation...
```blocks
input.onButtonPressed(Button.AB, () => {
@ -72,8 +64,11 @@ input.onButtonPressed(Button.AB, () => {
})
```
## Step 7
## Step 5
Click ``|Download|`` to transfer your code in your @boardname@
and show it off to your friends!
If you have a @boardname@, connect it to USB and click ``|Download|`` to transfer your code. Press button **A** on your @boardname@. Try button **B** and then **A** and **B** together.
## Step 6
Nice! Now go and show it off to your friends!

View File

@ -2,7 +2,7 @@
## Step 1
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?
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?
```blocks
basic.showString("Micro!")
@ -10,11 +10,7 @@ basic.showString("Micro!")
## Step 2
Connect a USB cable to the @boardname@ and click ``|Download|``. Save the program to the **@drivename@** drive. This transfers your code to the @boardname@!
## Step 3
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.
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.
```blocks
input.onButtonPressed(Button.A, () => {
@ -22,16 +18,10 @@ input.onButtonPressed(Button.A, () => {
});
```
## Step 4
Click ``|Download|`` to save and transfer your code again, then press button **A** to scroll your text.
## Step 5
## Step 3
Place some blocks to display a smiley when button **B** is pressed.
###
Use the dropdown to find ``B``!
```blocks
@ -46,13 +36,19 @@ input.onButtonPressed(Button.B, () => {
})
```
## Step 6
## Step 4
Place the ``||basic:show number||`` and ``||Math:pick random||`` blocks in an ``||input:on shake||`` slot to build a dice. A typical dice can show values from 1 to 6, so don't forget to choose the right minimum and maximum values!
Place the ``||basic:show number||`` and ``||Math:pick random||`` blocks in an ``||input:on shake||`` block to build a dice.
###
```blocks
input.onGesture(Gesture.Shake, () => {
basic.showNumber(Math.randomRange(0, 10))
})
```
When the @boardname@ is shaken, a random number between ``1`` and ``6`` is displayed on the screen.
## 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!
```blocks
input.onGesture(Gesture.Shake, () => {
@ -60,7 +56,14 @@ input.onGesture(Gesture.Shake, () => {
})
```
## Step 6
If you have a @boardname@, connect a USB cable it and click ``|Download|``. Save the program to the **@drivename@** drive. This transfers your code to the @boardname@!
## Step 7
Well done! You've completed your first Microsoft MakeCode activity.
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.
## Step 8
Well done! You've completed your first Microsoft MakeCode activity.