Rewritten for clarity. Already has great example!
This commit is contained in:
parent
84f14182bf
commit
899ca47a77
@ -1,10 +1,11 @@
|
|||||||
# Ring Tone
|
# Ring Tone
|
||||||
|
|
||||||
Play a continuous tone through pin P0.
|
Play a musical tone through pin `P0` with the pitch as high or low as you say.
|
||||||
|
The tone will keep playing until you tell it not to.
|
||||||
|
|
||||||
## 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.ringTone(440)
|
music.ringTone(440)
|
||||||
@ -12,11 +13,18 @@ music.ringTone(440)
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `frequency` : [Number](/reference/types/number) - Plays a tone in (Hz)
|
* a [number](/reference/types/number) that says the tone's
|
||||||
|
**frequency** (how high-pitched or low-pitched the tone is). This
|
||||||
|
number is in **Hz** (**Hertz**), which is a measurement of frequency
|
||||||
|
or pitch.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
Play a sound based on the tile of the device
|
This program checks the **accelerometer** for the micro:bit's
|
||||||
|
**acceleration** (how much the micro:bit is speeding up or slowing
|
||||||
|
down). Then it uses that acceleration to make a tone. If the micro:bit
|
||||||
|
speeds up, the tone's pitch gets higher, and if it slows down, the
|
||||||
|
tone's pitch gets lower. It's fun -- try it!
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
@ -26,5 +34,6 @@ basic.forever(() => {
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[rest](/reference/music/rest), [play tone](/reference/music/play-tone) , [tempo](/reference/music/tempo), [set tempo](/reference/music/set-tempo), [change tempo by](/reference/music/change-tempo-by)
|
[rest](/reference/music/rest), [play tone](/reference/music/play-tone),
|
||||||
|
[tempo](/reference/music/tempo), [set tempo](/reference/music/set-tempo),
|
||||||
|
[change tempo by](/reference/music/change-tempo-by)
|
||||||
|
Loading…
Reference in New Issue
Block a user