removing old 'getting-started' guide
This commit is contained in:
parent
5748af704b
commit
358596bb7e
@ -1,43 +0,0 @@
|
|||||||
# Getting started
|
|
||||||
|
|
||||||
### @description An activity for beginners to get started with the @boardname@
|
|
||||||
|
|
||||||
## ~avatar
|
|
||||||
|
|
||||||
Here are some challenges for you. Arrange the blocks in the editor
|
|
||||||
to make real programs that work!
|
|
||||||
|
|
||||||
## ~
|
|
||||||
|
|
||||||
Use the **Basic** drawer in the editor
|
|
||||||
to drag out and arrange three blocks to create this program:
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
basic.forever(() => {
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # . # .
|
|
||||||
. . . . .
|
|
||||||
# . . . #
|
|
||||||
. # # # .
|
|
||||||
`)
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
`)
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
When this program runs, you will see a smiley face, then a blank
|
|
||||||
screen, then a smiley again -- it never stops! (That's because of the
|
|
||||||
`[basic.forever(() => {})]` block.)
|
|
||||||
|
|
||||||
Click **Download** to move your program to the @boardname@!
|
|
||||||
Make sure to follow the instructions.
|
|
||||||
|
|
||||||
### ~button /getting-started/screen
|
|
||||||
NEXT: THE SCREEN
|
|
||||||
### ~
|
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -1,81 +0,0 @@
|
|||||||
# Button A and button B
|
|
||||||
|
|
||||||
### ~avatar avatar
|
|
||||||
|
|
||||||
Buttons are great to build games!
|
|
||||||
|
|
||||||
### ~
|
|
||||||
|
|
||||||
This program will show the word **ANTEATER** on the LED
|
|
||||||
screen when you press button `A`.
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
input.onButtonPressed(Button.A, () => {
|
|
||||||
basic.showString("ANTEATER");
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### ~hint
|
|
||||||
|
|
||||||
The `[basic.showString("HI")]` block can show letters, numbers, and punctuation
|
|
||||||
on the @boardname@ screen.
|
|
||||||
|
|
||||||
#### ~
|
|
||||||
|
|
||||||
Now try to unscramble these blocks in the editor so that the @boardname@
|
|
||||||
shows **BANANA** when you press button `B`.
|
|
||||||
|
|
||||||
```shuffle
|
|
||||||
input.onButtonPressed(Button.B, () => {
|
|
||||||
basic.showString("BANANA");
|
|
||||||
});
|
|
||||||
```
|
|
||||||
#### ~hint
|
|
||||||
|
|
||||||
You can find the letter `B` by clicking the letter `A` on the
|
|
||||||
`[input.onButtonPressed(Button.A, () => {})]` block.
|
|
||||||
|
|
||||||
#### ~
|
|
||||||
|
|
||||||
Click **Download** to move your program to the @boardname@!
|
|
||||||
|
|
||||||
#### Your turn!
|
|
||||||
|
|
||||||
Can you combine these blocks so your program shows your real name
|
|
||||||
instead of **ANTEATER** when you press `A`, but _your secret agent
|
|
||||||
name_ instead of **BANANA** when you press `B`?
|
|
||||||
|
|
||||||
### Pins
|
|
||||||
|
|
||||||
You can also use the pins as buttons. (The pins are the holes in the
|
|
||||||
metal stripe at the bottom of the @boardname@ board.) For example, hold
|
|
||||||
the ``GND`` button with one hand and touch the ``0`` pin (called
|
|
||||||
``P0``) with your other hand to tell the @boardname@ you're pressing it.
|
|
||||||
|
|
||||||
Unscramble the blocks in the editor to show a heart when you touch
|
|
||||||
pin ``P0``.
|
|
||||||
|
|
||||||
```shuffle
|
|
||||||
input.onPinPressed(TouchPin.P0, () => {
|
|
||||||
basic.showLeds(`
|
|
||||||
. # . # .
|
|
||||||
# . # . #
|
|
||||||
# . . . #
|
|
||||||
. # . # .
|
|
||||||
. . # . .`);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
Click **Download** to move your program to the @boardname@!
|
|
||||||
|
|
||||||
## ~hint
|
|
||||||
|
|
||||||
Try this experiment: find a friend and hold hands. Touch the ``GND``
|
|
||||||
pin while your friend presses the ``P0`` pin. You should see the
|
|
||||||
heart! The electric current is going through your bodies and across
|
|
||||||
your handshake to make it happen!
|
|
||||||
|
|
||||||
## ~
|
|
||||||
|
|
||||||
### ~button /getting-started/shake
|
|
||||||
NEXT: SHAKE
|
|
||||||
### ~
|
|
@ -1,205 +0,0 @@
|
|||||||
# Rock Paper Scissors
|
|
||||||
|
|
||||||
### ~avatar avatar
|
|
||||||
|
|
||||||
Build a Rock Paper Scissors game with the @boardname@! You can play
|
|
||||||
the game with a friend who has it on a @boardname@. You can also play
|
|
||||||
it with friends who are just using their hands. (The game is built
|
|
||||||
like a coin flipper, but with three choices instead of two.)
|
|
||||||
|
|
||||||
### ~
|
|
||||||
|
|
||||||
## Step 1: Getting started
|
|
||||||
|
|
||||||
We want the @boardname@ to choose rock, paper, or scissors when you
|
|
||||||
shake it. Try creating an ``on shake`` block so when you shake the
|
|
||||||
@boardname@, it will run part of a program.
|
|
||||||
|
|
||||||
Clear up the blocks and add the blocks below.
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
input.onGesture(Gesture.Shake, () => {
|
|
||||||
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
Next, when you shake the @boardname@, it should pick a random number from `0` to `2`
|
|
||||||
and store it in the variable `item`.
|
|
||||||
|
|
||||||
Add a ``set`` block with a variable. Then add a ``pick random`` block,
|
|
||||||
and store the random number in the variable,
|
|
||||||
like this:
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
input.onGesture(Gesture.Shake, () => {
|
|
||||||
let item = Math.random(3)
|
|
||||||
})
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
### ~hint
|
|
||||||
No one can predict random numbers. That's what makes them great for Rock Paper Scissors!
|
|
||||||
### ~
|
|
||||||
|
|
||||||
Each possible number these blocks can make (`0`, `1`, or `2`) means a different picture.
|
|
||||||
We will show the right picture for that number on the LED screen.
|
|
||||||
|
|
||||||
|
|
||||||
## Step 2: Picking paper
|
|
||||||
|
|
||||||
Put an ``if`` block after the ``let`` block that checks whether
|
|
||||||
`item` is `0`. Make sure the ``if`` block has an ``else if`` part
|
|
||||||
and an ``else`` part.
|
|
||||||
|
|
||||||
Next, add a ``show leds`` block that shows a
|
|
||||||
picture of a piece of paper:
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
input.onGesture(Gesture.Shake, () => {
|
|
||||||
let item = Math.random(3)
|
|
||||||
if (item == 0) {
|
|
||||||
basic.showLeds(`
|
|
||||||
# # # # #
|
|
||||||
# . . . #
|
|
||||||
# . . . #
|
|
||||||
# . . . #
|
|
||||||
# # # # #
|
|
||||||
`)
|
|
||||||
} else if (false) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## Step 3: A random rock
|
|
||||||
|
|
||||||
Now we are going to add a new picture for the @boardname@ to show
|
|
||||||
when another random number comes up.
|
|
||||||
|
|
||||||
Make the ``else if`` part check if the variable `item` is `1`.
|
|
||||||
Then add a ``show leds`` block with a picture of a rock.
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
input.onGesture(Gesture.Shake, () => {
|
|
||||||
let item = Math.random(3)
|
|
||||||
if (item == 0) {
|
|
||||||
basic.showLeds(`
|
|
||||||
# # # # #
|
|
||||||
# . . . #
|
|
||||||
# . . . #
|
|
||||||
# . . . #
|
|
||||||
# # # # #
|
|
||||||
`)
|
|
||||||
} else if (item == 1) {
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # # # .
|
|
||||||
. # # # .
|
|
||||||
. # # # .
|
|
||||||
. . . . .
|
|
||||||
`)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## Step 4: Suddenly scissors
|
|
||||||
|
|
||||||
Add a ``show leds`` block with a picture of scissors to the ``else`` part:
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
input.onGesture(Gesture.Shake, () => {
|
|
||||||
let item = Math.random(3)
|
|
||||||
if (item == 0) {
|
|
||||||
basic.showLeds(`
|
|
||||||
# # # # #
|
|
||||||
# . . . #
|
|
||||||
# . . . #
|
|
||||||
# . . . #
|
|
||||||
# # # # #
|
|
||||||
`)
|
|
||||||
|
|
||||||
} else if (item == 1) {
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # # # .
|
|
||||||
. # # # .
|
|
||||||
. # # # .
|
|
||||||
. . . . .
|
|
||||||
`)
|
|
||||||
} else {
|
|
||||||
basic.showLeds(`
|
|
||||||
# # . . #
|
|
||||||
# # . # .
|
|
||||||
. . # . .
|
|
||||||
# # . # .
|
|
||||||
# # . . #
|
|
||||||
`)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
### ~hint
|
|
||||||
|
|
||||||
You don't need to check if `item` is `2` because `2` is the only number left out of `0`, `1`, and `2`.
|
|
||||||
That's why you can use an ``else`` instead of an ``else if``.
|
|
||||||
|
|
||||||
### ~
|
|
||||||
|
|
||||||
Your game is ready!
|
|
||||||
|
|
||||||
Click **Download** to move your program to the @boardname@!
|
|
||||||
|
|
||||||
Have fun!
|
|
||||||
|
|
||||||
## Step 5: Are you the greatest?
|
|
||||||
|
|
||||||
Here is a way you can make your Rock Paper Scissors game better.
|
|
||||||
When button ``A`` is pressed,
|
|
||||||
the @boardname@ will add `1` to your score.
|
|
||||||
|
|
||||||
Open the ``Game`` drawer, and then add the block ``change score by 1`` to your program,
|
|
||||||
like this:
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
input.onButtonPressed(Button.A, () => {
|
|
||||||
game.addScore(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Step 6: Prove you're the greatest!
|
|
||||||
|
|
||||||
After your @boardname@ can add `1` to the score, show how many wins you have.
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
input.onButtonPressed(Button.A, () => {
|
|
||||||
game.addScore(1)
|
|
||||||
basic.showString("WINS:")
|
|
||||||
basic.showNumber(game.score())
|
|
||||||
})
|
|
||||||
```
|
|
||||||
## Step 7: Staying honest
|
|
||||||
|
|
||||||
Success! Your @boardname@ can track wins!
|
|
||||||
But what about losses?
|
|
||||||
Use the ``Game`` drawer to subtract `1` from your score when you press button `B`.
|
|
||||||
|
|
||||||
Here are all the blocks you will need:
|
|
||||||
|
|
||||||
```shuffle
|
|
||||||
input.onButtonPressed(Button.B, () => {
|
|
||||||
game.addScore(-1)
|
|
||||||
basic.showString("LOSSES:")
|
|
||||||
basic.showNumber(game.score())
|
|
||||||
})
|
|
||||||
```
|
|
||||||
Click **Download** to move your program to the @boardname@!
|
|
||||||
|
|
||||||
### ~button /projects
|
|
||||||
NEXT: PROJECTS!
|
|
||||||
### ~
|
|
@ -1,92 +0,0 @@
|
|||||||
# Screen
|
|
||||||
|
|
||||||
### ~avatar avatar
|
|
||||||
|
|
||||||
There are 25 bright LEDs on the @boardname@ screen. Let's use them to create some cool animations!
|
|
||||||
|
|
||||||
### ~
|
|
||||||
|
|
||||||
### Happy unhappy face
|
|
||||||
|
|
||||||
Draw an unhappy face instead of the blank screen. Click on the dots
|
|
||||||
in the second `[basic.showLeds("")]` block until it matches the blocks below.
|
|
||||||
Now you have an **animation** (cartoon) that shows a happy face,
|
|
||||||
then an unhappy one, then a happy one again, forever (or until
|
|
||||||
you turn off your @boardname@)!
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
basic.forever(() => {
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # . # .
|
|
||||||
. . . . .
|
|
||||||
# . . . #
|
|
||||||
. # # # .
|
|
||||||
`)
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # . # .
|
|
||||||
. . . . .
|
|
||||||
. # # # .
|
|
||||||
# . . . #
|
|
||||||
`)
|
|
||||||
});
|
|
||||||
```
|
|
||||||
Click **Download** to move your program to the @boardname@!
|
|
||||||
|
|
||||||
### Your turn!
|
|
||||||
|
|
||||||
Pile up more `[basic.showLeds("")]` blocks to create an animation! Create an
|
|
||||||
animation with at least 5 pictures. What does this animation show?
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
basic.forever(() => {
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # . # .
|
|
||||||
. . . . .
|
|
||||||
# . . . #
|
|
||||||
. # # # .
|
|
||||||
`)
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # . # .
|
|
||||||
. . . . .
|
|
||||||
# # # # #
|
|
||||||
. . . . .
|
|
||||||
`)
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # . # .
|
|
||||||
. . . . .
|
|
||||||
. # # # .
|
|
||||||
# . . . #
|
|
||||||
`)
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # . # .
|
|
||||||
. . . . .
|
|
||||||
# # # # #
|
|
||||||
. . . # #
|
|
||||||
`)
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
# . # . .
|
|
||||||
. . . . .
|
|
||||||
# . . . #
|
|
||||||
. # # # .
|
|
||||||
`)
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. . # . #
|
|
||||||
. . . . .
|
|
||||||
# . . . #
|
|
||||||
. # # # .
|
|
||||||
`)
|
|
||||||
});
|
|
||||||
```
|
|
||||||
Click **Download** to move your program to the @boardname@!
|
|
||||||
|
|
||||||
### ~button /getting-started/buttons
|
|
||||||
NEXT: BUTTONS
|
|
||||||
### ~
|
|
@ -1,24 +0,0 @@
|
|||||||
# Shake
|
|
||||||
|
|
||||||
You can find when someone is shaking the @boardname@ by checking its
|
|
||||||
**accelerometer** (it finds whether the @boardname@ is speeding up or
|
|
||||||
slowing down).
|
|
||||||
|
|
||||||
Unscramble these blocks in the editor to show a frownie when someone
|
|
||||||
shakes the @boardname@. (Ouch!)
|
|
||||||
|
|
||||||
```shuffle
|
|
||||||
input.onGesture(Gesture.Shake, () => {
|
|
||||||
basic.showLeds(`
|
|
||||||
. . . . .
|
|
||||||
. # . # .
|
|
||||||
. . . . .
|
|
||||||
. # # # .
|
|
||||||
# . . . #`);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
Click **Download** to move your program to the @boardname@!
|
|
||||||
|
|
||||||
### ~button /getting-started/coin-flipper
|
|
||||||
NEXT: COIN FLIPPER GAME
|
|
||||||
### ~
|
|
@ -72,7 +72,3 @@ input.onButtonPressed(Button.AB, () => {
|
|||||||
```
|
```
|
||||||
|
|
||||||
Flip until your thumbs get tired!
|
Flip until your thumbs get tired!
|
||||||
|
|
||||||
### ~button /getting-started/rock-paper-scissors
|
|
||||||
NEXT: ROCK PAPER SCISSORS
|
|
||||||
### ~
|
|
@ -41,7 +41,7 @@ Try pressing button A!
|
|||||||
|
|
||||||
## Step 3
|
## Step 3
|
||||||
|
|
||||||
Now add blocks so that when [button B is pressed](/reference/input/on-button-pressed),
|
Add blocks so that when [button B is pressed](/reference/input/on-button-pressed),
|
||||||
a frowney appears:
|
a frowney appears:
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
@ -67,6 +67,58 @@ input.onButtonPressed(Button.B, () => {
|
|||||||
|
|
||||||
Try pressing ``A`` or ``B``!
|
Try pressing ``A`` or ``B``!
|
||||||
|
|
||||||
|
## Step 4
|
||||||
|
|
||||||
|
You can also have a secret mode where ``A`` and ``B`` are pressed together.
|
||||||
|
In that case, add multiple ``||show leds||`` blocks to create an animation...
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
input.onButtonPressed(Button.AB, () => {
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# # # # #
|
||||||
|
. . . . .
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
. # # # .
|
||||||
|
# . . . #
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# # # # #
|
||||||
|
. . . # #
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
# . # . .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. . # . #
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## Send your smileys over radio
|
## Send your smileys over radio
|
||||||
|
|
||||||
Do you have a second @boardname@ at hand? You could use radio and send your smileys or frownies to other
|
Do you have a second @boardname@ at hand? You could use radio and send your smileys or frownies to other
|
||||||
|
Loading…
Reference in New Issue
Block a user