This commit is contained in:
Peli de Halleux 2016-06-07 14:21:28 -07:00
commit eea179e07c
3 changed files with 43 additions and 30 deletions

View File

@ -234,7 +234,6 @@ Here are the blocks to make your coin flipper. When you press button
on the LED screen. on the LED screen.
```blocks ```blocks
basic.forever(() => {
input.onButtonPressed(Button.B, () => { input.onButtonPressed(Button.B, () => {
if (Math.randomBoolean()) { if (Math.randomBoolean()) {
basic.showString("H"); basic.showString("H");
@ -242,14 +241,12 @@ basic.forever(() => {
basic.showString("T"); basic.showString("T");
} }
}); });
});
``` ```
### ~hint ### ~hint
The ``pick random true or false`` block randomly tells the ``if`` The ``pick random true or false`` block randomly tells the ``if``
block `true` or `false`. If the ``pick`` block block `true` or `false`. If the ``pick`` block picked `true`, the
picked `true`, the ``if`` block shows the letter `H`. Otherwise, it ``if`` block shows the letter `H`. Otherwise, it shows the letter `T`.
shows the letter `T`.
That's it! That's it!
@ -280,7 +277,6 @@ show your score.
When you're done, your coin flipping program should look like this: When you're done, your coin flipping program should look like this:
```blocks ```blocks
basic.forever(() => {
input.onButtonPressed(Button.B, () => { input.onButtonPressed(Button.B, () => {
if (Math.randomBoolean()) { if (Math.randomBoolean()) {
basic.showString("H"); basic.showString("H");
@ -294,7 +290,6 @@ basic.forever(() => {
input.onButtonPressed(Button.AB, () => { input.onButtonPressed(Button.AB, () => {
basic.showNumber(game.score()); basic.showNumber(game.score());
}); });
});
``` ```
Flip until your thumbs get tired! Flip until your thumbs get tired!

View File

@ -1,10 +1,11 @@
# Change Tempo By # Change Tempo By
Change the tempo by the specified amount Makes the [tempo](/reference/music/tempo) (speed of a piece of music)
faster or slower by the amount you say.
## Simulator ## Simulator
Simulation of this function is available in many, but not all browsers. This function only works on the micro:bit and in some browsers.
```sig ```sig
music.changeTempoBy(20) music.changeTempoBy(20)
@ -12,7 +13,21 @@ music.changeTempoBy(20)
### Parameters ### Parameters
* `bpm` : [Number](/reference/types/number) - change the tempo by beats per minute * a [number](/reference/types/number) that says how much to change the bpm (beats per minute, or number of beats in a minute of the music that the micro:bit is playing).
### Examples
This program makes the music faster by 12 bpm.
```blocks
music.changeTempoBy(12)
```
This program makes the music _slower_ by 12 bpm.
```blocks
music.changeTempoBy(-12)
```
### See also ### See also

View File

@ -1,14 +1,17 @@
# Set Tempo # Set Tempo
Sets the tempo to the specified amount Makes the tempo (speed of a piece of music) as fast or slow as you say.
```sig ```sig
music.setTempo(60) music.setTempo(60)
``` ```
## Simulator
This function only works on the micro:bit and in some browsers.
### Parameters ### Parameters
* Returns : [Number](/reference/types/number) - sets the tempo in beats per minute * a [number](/reference/types/number) that means the bpm you want (beats per minute, or number of beats in a minute of the music that the micro:bit is playing).
### See also ### See also