Updated to be funner (and clearer)
This commit is contained in:
parent
e6761699d3
commit
40305c3ccd
@ -7,8 +7,8 @@ to make real programs that work!
|
|||||||
|
|
||||||
### Happy face
|
### Happy face
|
||||||
|
|
||||||
You should see three blocks in the editor to the left.
|
There are three blocks in the editor (the area to the left).
|
||||||
These are a block with a smiley face, ...
|
They should look like this:
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
@ -29,6 +29,10 @@ basic.forever(() => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When you run this program, you will see a smiley face, then a blank
|
||||||
|
screen, then a smiley again -- it never stops! (That's because of the
|
||||||
|
``forever`` block.)
|
||||||
|
|
||||||
To move your program from your computer to the BBC micro:bit:
|
To move your program from your computer to the BBC micro:bit:
|
||||||
* Connect your micro:bit to the computer with the USB cable.
|
* Connect your micro:bit to the computer with the USB cable.
|
||||||
* Click **Compile**.
|
* Click **Compile**.
|
||||||
@ -37,8 +41,11 @@ To move your program from your computer to the BBC micro:bit:
|
|||||||
|
|
||||||
### Happy unhappy face
|
### Happy unhappy face
|
||||||
|
|
||||||
Let's draw an unhappy face instead of the blank screen. Click on the dots in the ``show leds`` block
|
Draw an unhappy face instead of the blank screen. Click on the dots
|
||||||
until it matches the blocks below.
|
in the second ``show leds`` 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 micro:bit)!
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
@ -67,7 +74,8 @@ To move your program from your computer to the BBC micro:bit:
|
|||||||
|
|
||||||
### Your turn!
|
### Your turn!
|
||||||
|
|
||||||
Pile up more ``show leds`` blocks to create your animation! Create an animation with at least 5 images.
|
Pile up more ``show leds`` blocks to create your animation! Create an
|
||||||
|
animation with at least 5 pictures. What does this animation show?
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
@ -78,6 +86,13 @@ basic.forever(() => {
|
|||||||
# . . . #
|
# . . . #
|
||||||
. # # # .
|
. # # # .
|
||||||
`)
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# # # # #
|
||||||
|
. . . . .
|
||||||
|
`)
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
. . . . .
|
. . . . .
|
||||||
. # . # .
|
. # . # .
|
||||||
@ -90,7 +105,21 @@ basic.forever(() => {
|
|||||||
. # . # .
|
. # . # .
|
||||||
. . . . .
|
. . . . .
|
||||||
# # # # #
|
# # # # #
|
||||||
|
. . . # #
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
. . . . .
|
. . . . .
|
||||||
|
# . # . .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. . # . #
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
`)
|
`)
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -103,28 +132,38 @@ To move your program from your computer to the BBC micro:bit:
|
|||||||
|
|
||||||
#### ~hint
|
#### ~hint
|
||||||
|
|
||||||
You can find the ``show leds`` block under the **Basic** category.
|
You can find the ``show leds`` block in the **Basic** part of the editor.
|
||||||
|
|
||||||
#### ~
|
#### ~
|
||||||
|
|
||||||
### Button A and B
|
### Button A and button B
|
||||||
|
|
||||||
This program will show the word `banana` on the LED
|
This program will show the word **anteater** on the LED
|
||||||
screen when you press button `A`.
|
screen when you press button `A`.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonPressed(Button.A, () => {
|
input.onButtonPressed(Button.A, () => {
|
||||||
basic.showString("banana");
|
basic.showString("anteater");
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Now try to unscramble these blocks in the editor so that the micro:bit
|
Now try to unscramble these blocks in the editor so that the micro:bit
|
||||||
shows **apple** when you press button `B`.
|
shows **banana** when you press button `B`.
|
||||||
|
|
||||||
```shuffle
|
```shuffle
|
||||||
input.onButtonPressed(Button.B, () => {
|
input.onButtonPressed(Button.B, () => {
|
||||||
basic.showString("apple");
|
basic.showString("banana");
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
#### ~hint
|
||||||
|
|
||||||
|
You can find the letter `B` by clicking the letter `A` on the
|
||||||
|
``onButtonPressed`` block.
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
Can you combine these blocks so your program shows **anteater** when
|
||||||
|
you press `A`, but **banana** when you press `B`?
|
||||||
|
|
||||||
### Shake
|
### Shake
|
||||||
|
|
||||||
@ -133,7 +172,7 @@ You can find when someone is shaking the BBC micro:bit by checking its
|
|||||||
slowing down).
|
slowing down).
|
||||||
|
|
||||||
Unscramble these blocks in the editor to show a frownie when someone
|
Unscramble these blocks in the editor to show a frownie when someone
|
||||||
shakes the micro:bit.
|
shakes the micro:bit. (Ouch!)
|
||||||
|
|
||||||
```shuffle
|
```shuffle
|
||||||
input.onGesture(Gesture.Shake, () => {
|
input.onGesture(Gesture.Shake, () => {
|
||||||
@ -150,13 +189,14 @@ input.onGesture(Gesture.Shake, () => {
|
|||||||
|
|
||||||
You can also find when someone is tilting the micro:bit left or right,
|
You can also find when someone is tilting the micro:bit left or right,
|
||||||
face up or face down, and logo up or logo down (the logo is the yellow
|
face up or face down, and logo up or logo down (the logo is the yellow
|
||||||
oval picture at the top of the board).
|
oval picture at the top of the board). Tilting a micro:bit like this
|
||||||
|
is called a **gesture**.
|
||||||
|
|
||||||
Try to build a Rock Paper Scissors game where you tilt the micro:bit
|
Try to build a Rock Paper Scissors game where you tilt the micro:bit
|
||||||
left to show paper, right to show scissors, and down to show rock.
|
left to show paper, right to show scissors, and down to show rock.
|
||||||
|
|
||||||
Unscramble these blocks in the editor and try this program on the
|
Unscramble these blocks in the editor and try this program on a real
|
||||||
micro:bit itself!
|
micro:bit!
|
||||||
|
|
||||||
```shuffle
|
```shuffle
|
||||||
input.onGesture(Gesture.TiltLeft, () => {
|
input.onGesture(Gesture.TiltLeft, () => {
|
||||||
@ -188,7 +228,7 @@ input.onGesture(Gesture.TiltRight, () => {
|
|||||||
### Pins
|
### Pins
|
||||||
|
|
||||||
You can also use the pins as buttons. (The pins are the holes in the
|
You can also use the pins as buttons. (The pins are the holes in the
|
||||||
metal bar at the bottom of the micro:bit board.) For example, hold
|
metal stripe at the bottom of the micro:bit board.) For example, hold
|
||||||
the ``GND`` button with one hand and touch the ``0`` pin (called
|
the ``GND`` button with one hand and touch the ``0`` pin (called
|
||||||
``P0``) with your other hand to tell the micro:bit you're pressing it.
|
``P0``) with your other hand to tell the micro:bit you're pressing it.
|
||||||
|
|
||||||
@ -209,4 +249,15 @@ input.onPinPressed(TouchPin.P0, () => {
|
|||||||
### Your turn!
|
### Your turn!
|
||||||
|
|
||||||
Use the screen, buttons, gestures, and pins to make your own fun game
|
Use the screen, buttons, gestures, and pins to make your own fun game
|
||||||
with the BBC micro:bit!
|
with the BBC micro:bit! What about some of these?
|
||||||
|
|
||||||
|
* A backpack burglar alarm
|
||||||
|
* Daily news broadcaster for your class
|
||||||
|
* Animated jewelry
|
||||||
|
* A _complete_ animated cartoon
|
||||||
|
* A calculator
|
||||||
|
* A music box
|
||||||
|
|
||||||
|
These are all things you can make with the BBC micro:bit by itself.
|
||||||
|
Just think what you can do if you connect the micro:bit's pins to
|
||||||
|
extra parts like microphones and other **sensors**!
|
||||||
|
Loading…
Reference in New Issue
Block a user