pxt-microbit 5.1.2 → 5.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/built/sim-strings.json +1 -17
  2. package/built/sim.js +1 -1
  3. package/built/target-strings.json +1 -57
  4. package/built/target.js +1 -44155
  5. package/built/target.json +1 -44155
  6. package/built/targetlight.json +1 -408
  7. package/built/theme.json +1 -2311
  8. package/built/web/blockly.css +1 -1
  9. package/built/web/react-common-authcode.css +4 -6777
  10. package/built/web/react-common-multiplayer.css +13 -0
  11. package/built/web/react-common-skillmap.css +1 -1
  12. package/built/web/rtlblockly.css +1 -1
  13. package/built/web/rtlreact-common-authcode.css +13 -0
  14. package/built/web/rtlreact-common-multiplayer.css +13 -0
  15. package/built/web/rtlreact-common-skillmap.css +1 -1
  16. package/built/web/rtlsemantic.css +2 -2
  17. package/built/web/semantic.css +2 -2
  18. package/docs/device/v2.md +1 -1
  19. package/docs/extensions.md +32 -0
  20. package/docs/microcode.md +27 -0
  21. package/docs/projects/SUMMARY.md +6 -0
  22. package/docs/projects/electric-guitar/code.md +42 -0
  23. package/docs/projects/electric-guitar/make.md +40 -0
  24. package/docs/projects/electric-guitar.md +27 -0
  25. package/docs/projects/jonnys-bird.md +110 -0
  26. package/docs/projects/music.md +10 -0
  27. package/docs/projects/red-light-green-light.md +1 -1
  28. package/docs/projects.md +6 -0
  29. package/docs/reference/music/beat.md +1 -7
  30. package/docs/reference/music/change-tempo-by.md +5 -3
  31. package/docs/reference/music/play-tone.md +28 -15
  32. package/docs/reference/music/rest.md +28 -10
  33. package/docs/reference/music/ring-tone.md +7 -6
  34. package/docs/reference/music/set-tempo.md +7 -3
  35. package/docs/translate.md +53 -22
  36. package/docs/windows-app.md +3 -3
  37. package/package.json +2 -2
  38. package/pxtarget.json +3 -4
  39. package/targetconfig.json +11 -2
package/docs/device/v2.md CHANGED
@@ -58,7 +58,7 @@ The first thing to know is whether you have a micro:bit v1 or micro:bit v2 at ha
58
58
  ![micro:bit v1 and micro:bit v2 front side by side](/static/v2/front.jpg)
59
59
 
60
60
  * red power LED next to the USB connect
61
- * large black microphone component centrally located in the back and rotated by 45 degrees
61
+ * large black speaker component centrally located in the back and rotated by 45 degrees
62
62
  * slanted radio antenna
63
63
 
64
64
  ![micro:bit v1 and micro:bit v2 back side by side](/static/v2/back.jpg)
@@ -303,6 +303,10 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
303
303
  "name": "HTS221 Humidity and temperature",
304
304
  "url": "/pkg/makecode-extensions/HTS221",
305
305
  "cardType": "package"
306
+ }, {
307
+ "name": "gator:UV UV Light sensor",
308
+ "url":"/pkg/sparkfun/pxt-gator-UV",
309
+ "cardType": "package"
306
310
  }]
307
311
  ```
308
312
 
@@ -415,6 +419,10 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
415
419
  "name": "Minode Kit",
416
420
  "url":"/pkg/minodekit/pxt-minode",
417
421
  "cardType": "package"
422
+ }, {
423
+ "name": "DFRobot Boson Kit",
424
+ "url":"/pkg/dfrobot/pxt-dfrobot_bosonkit",
425
+ "cardType": "package"
418
426
  }]
419
427
  ```
420
428
 
@@ -485,6 +493,14 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
485
493
 
486
494
  ```codecard
487
495
  [{
496
+ "name": "MAKE&LEARN Didacbot",
497
+ "url":"/pkg/MakeAndLearn/pxt-didacbot",
498
+ "cardType": "package"
499
+ }, {
500
+ "name": "Resolute Apprentice Car",
501
+ "url":"/pkg/resolute-support/pxt-apprentice_Car",
502
+ "cardType": "package"
503
+ }, {
488
504
  "name": "Elecfreaks XGO",
489
505
  "url":"/pkg/elecfreaks/pxt-xgo",
490
506
  "cardType": "package"
@@ -743,6 +759,14 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
743
759
 
744
760
  ```codecard
745
761
  [{
762
+ "name": "Joy IT RFID Module MFRC-522",
763
+ "url": "/pkg/joy-it/pxt-rfid-mfrc522",
764
+ "cardType": "package"
765
+ }, {
766
+ "name": "Joy-IT ADS1115",
767
+ "url":"/pkg/joy-it/pxt-ads1115",
768
+ "cardType": "package"
769
+ }, {
746
770
  "name": "DFRobot Environment Science Board ",
747
771
  "url":"/pkg/DFRobot/pxt-DFRobot_Environment_Science",
748
772
  "cardType": "package"
@@ -872,6 +896,14 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
872
896
  ## Utilities
873
897
  ```codecard
874
898
  [{
899
+ "name": "Button clicks",
900
+ "url": "/pkg/bsiever/microbit-pxt-clicks",
901
+ "cardType": "package"
902
+ }, {
903
+ "name": "Rotate Display",
904
+ "url":"/pkg/bsiever/microbit-pxt-rotate",
905
+ "cardType": "package"
906
+ }, {
875
907
  "name": "Bluetooth HID",
876
908
  "url":"/pkg/bsiever/microbit-pxt-blehid",
877
909
  "cardType": "package"
@@ -0,0 +1,27 @@
1
+ # MicroCode
2
+
3
+ [MicroCode](https://aka.ms/m9) is an experimental tile-based language and editor for young coders and coders with disabilities on the BBC micro:bit V2 (V1 not supported), inspired by Kodu Game Lab.
4
+
5
+ ## Getting started
6
+
7
+ ```codecard
8
+ [{
9
+ "name": "Getting Started",
10
+ "description": "MicroCode is an experimental tile-based language and editor for young coders and coders with disabilities on the BBC micro:bit V2 (V1 not supported), inspired by Kodu Game Lab.",
11
+ "url":"https://microsoft.github.io/microcode",
12
+ "imageUrl": "/static/microcode/home.png"
13
+ },
14
+ {
15
+ "name": "User Guide",
16
+ "description": "Learn how to use MicroCode editor and language.",
17
+ "url": "https://microsoft.github.io/microcode/docs/manual",
18
+ "imageUrl": "/static/microcode/userguide.png"
19
+ },
20
+ {
21
+ "name": "Samples",
22
+ "description": "Annotated MicroCode programs with screen animations, sounds, radio messages and more.",
23
+ "url": "https://microsoft.github.io/microcode/docs/samples",
24
+ "imageUrl": "/static/microcode/samples.png"
25
+ }
26
+ ]
27
+ ```
@@ -85,6 +85,8 @@
85
85
  * [Hack Your Headphones](/projects/hack-your-headphones)
86
86
  * [Banana Keyboard](/projects/banana-keyboard)
87
87
  * [Guitar](/projects/guitar)
88
+ * [Jonny's Bird](/projects/jonnys-bird)
89
+ * [Electric Guitar](/projects/electric-guitar)
88
90
  * [Toys](/projects/toys)
89
91
  * [Inchworm](/projects/inchworm)
90
92
  * [Milk Carton Robot](/projects/milk-carton-robot)
@@ -148,6 +150,10 @@
148
150
  * [Rotary Sound Bender](https://microsoft.github.io/jacdac-docs/clients/makecode/projects/rotary-sound-bender/)
149
151
  * [Sound LED](https://microsoft.github.io/jacdac-docs/clients/makecode/projects/sound-led/)
150
152
  * [Magnetic Sound Bender](https://microsoft.github.io/jacdac-docs/clients/makecode/projects/magnetic-sound-bender/)
153
+ * [MicroCode for the new micro:bit (V2)](/microcode)
154
+ * [Getting Started](https://microsoft.github.io/microcode)
155
+ * [User Guide](https://microsoft.github.io/microcode/docs/manual)
156
+ * [Samples](https://microsoft.github.io/microcode/docs/samples)
151
157
  * [Behind the MakeCode Hardware](/behind-the-makecode-hardware)
152
158
  * [LEDs](https://youtu.be/qqBmvHD5bCw)
153
159
  * [Buttons](https://youtu.be/t_Qujjd_38o)
@@ -0,0 +1,42 @@
1
+ # Code
2
+
3
+ Let's add code so that whenever we press or touch the foil chords it will produce sound.
4
+
5
+ From the [Make](/projects/electric-guitar/make.md) project, we know that whenever user touches the chords, sound will be produced and diffrent chords will produce diffrent sounds.
6
+
7
+ ## Code your electric guitar
8
+
9
+ Download this code to your micro:bit. It creates the tones that play when you press the foil strips on the guitar.
10
+
11
+ ```blocks
12
+ input.onButtonPressed(Button.A, function () {
13
+ F = F / 2
14
+ A = A / 2
15
+ C = C / 2
16
+ E = E / 2
17
+ })
18
+ input.onPinPressed(TouchPin.P2, function () {
19
+ music.playTone(988, music.beat(BeatFraction.Whole))
20
+ music.playTone(165, music.beat(BeatFraction.Whole))
21
+ music.playTone(932, music.beat(BeatFraction.Whole))
22
+ })
23
+ input.onButtonPressed(Button.B, function () {
24
+ F = F * 2
25
+ A = A * 2
26
+ C = C * 2
27
+ E = E * 2
28
+ })
29
+ input.onPinPressed(TouchPin.P1, function () {
30
+ music.playTone(F, music.beat(BeatFraction.Half))
31
+ music.playTone(A, music.beat(BeatFraction.Half))
32
+ music.playTone(C, music.beat(BeatFraction.Half))
33
+ })
34
+ let E = 0
35
+ let C = 0
36
+ let A = 0
37
+ let F = 0
38
+ F = 349
39
+ A = 440
40
+ C = 523
41
+ E = 659
42
+ ```
@@ -0,0 +1,40 @@
1
+ # Make
2
+
3
+ A guitar is a plucked stringed musical instrument. Normally, the guitar is an expensive instrument, but here we create a cheap and convenient DIY instrument that can help you enjoy and play real chords on an electric micro:bit guitar. Have fun and enjoy playing the micro:bit guitar by shifting the pitch up and down octaves.
4
+
5
+ ## How it Works?
6
+
7
+ When you touch pin **1** or pin **2** and **GND** it will play a broken chord, but now you can move the chord down an octave (lowering its pitch) by pressing button **A** and move it up an octave (raising its pitch) by pressing button **B**.
8
+
9
+ The pitch (frequency) of a note doubles when you move up one octave: `middle A` has a frequency of 440Hz (440 vibrations per second), `high A` has a frequency of 880Hz. This is why making the vibrating part of guitar strings different lengths with your fingers changes the pitch of the note being played.
10
+
11
+ ## Materials you need
12
+
13
+ * micro:bit and optional battery pack
14
+ * 4 crocodile clip leads
15
+ * cardboard, scissors, glue, tin foil
16
+ * headphones, buzzer, or powered speaker
17
+
18
+ ## How to build and play your electric guitar
19
+
20
+ Watch this video to see how to make your electric guitar and play it:
21
+
22
+ https://youtu.be/Yocsl_80YsY
23
+
24
+ You can connect the electric guitar to some headphones with some crocodile clips you attach to the phone jack.
25
+
26
+ ![Output connections for sound](/static/mb/projects/electric-guitar/connections.jpg)
27
+
28
+ Here are two pictures of the finished electric guitar with its connections:
29
+
30
+ ![Electric guitar project 1](/static/mb/projects/electric-guitar/guitar-board1.jpg)
31
+
32
+ ![Electric guitar project 2](/static/mb/projects/electric-guitar/guitar-board2.jpg)
33
+
34
+ Let's go on to code the guitar!
35
+
36
+ ### ~button /projects/electric-guitar/code
37
+
38
+ Code
39
+
40
+ ### ~
@@ -0,0 +1,27 @@
1
+ # Electric Guitar
2
+
3
+ ## ~avatar avatar
4
+
5
+ Make an electric guitar that you can play real chords with using the micro:bit.
6
+
7
+ ## ~
8
+
9
+ https://youtu.be/Yocsl_80YsY
10
+
11
+ ## Materials
12
+
13
+ * micro:bit and optional battery pack
14
+ * 4 crocodile clip leads
15
+ * cardboard, scissors, glue, tin foil
16
+ * headphones, buzzer, or powered speaker
17
+
18
+ ## Activities
19
+
20
+ * [Make](/projects/electric-guitar/make)
21
+ * [Code](/projects/electric-guitar/code)
22
+
23
+ ## ~button /projects/electric-guitar/make
24
+
25
+ Let's get started!
26
+
27
+ ## ~
@@ -0,0 +1,110 @@
1
+ # Jonny's Bird
2
+
3
+ The ``||music:play sound||`` block lets you create and play complex sounds beyond the simple sequence of tones in a melody. You can choose a sound waveform, change its frequency or volume, and add custom effects. Here's a program you can code to create fun bird sounds when you shake or tilt the @boardname@!
4
+
5
+ ## Use acceleration to set frequency
6
+
7
+ The acceleration in the `X`and `Y` dimensions are used to set the frequencies of the sound. Make two variables named ``||variables:currFreq||`` and ``||variables:lastFreq||``. One variable will hold the value for the current freqency as an input of accleration in the `X` direction. The other will remember the previous frequency value.
8
+
9
+ Get a ``||loops:forever||`` block and pull the ``||variables:set currFreq||`` and ``||variables:set lastFreq||`` blocks into it. Change the value for ``||variables:set lastFreq||`` from `0` to ``||variables:currFreq||``.
10
+
11
+ ```blocks
12
+ let currfreq = 0
13
+ let lastfreq = 0
14
+ basic.forever(function () {
15
+ currfreq = 0
16
+ lastfreq = currfreq
17
+ })
18
+ ```
19
+
20
+ Pull a ``||math:map from to||`` block into the value slot of the ``||variables:set currFreq||``. Use ``||input:acceleration (mg) x||`` as the mapping value, set the `from` value range as `-1024` and `1023`. Set the `to` value range as `0` and `5000`.
21
+
22
+ ```blocks
23
+ let currfreq = 0
24
+ let lastfreq = 0
25
+ basic.forever(function () {
26
+ currfreq = Math.map(input.acceleration(Dimension.X), -1024, 1023, 1, 5000)
27
+ lastfreq = currfreq
28
+ })
29
+ ```
30
+
31
+ Go get a ``||music:play sound until done||`` block and place it in between the ``||variables:set currFreq||`` and ``||variables:set lastFreq||``.
32
+
33
+ ```blocks
34
+ let currFreq = 0
35
+ let lastFreq = 0
36
+ basic.forever(function () {
37
+ currFreq = Math.map(input.acceleration(Dimension.X), -1024, 1023, 0, 5000)
38
+ music.playSoundEffect(music.createSoundEffect(WaveShape.Sine, 5000, 0, 255, 0, 500, SoundExpressionEffect.None, InterpolationCurve.Linear), SoundExpressionPlayMode.UntilDone)
39
+ lastFreq = currFreq
40
+ })
41
+ ```
42
+
43
+ Expand the sound effect parameters in ``||music:play sound until done||`` by clicking the **(+)** symbol. Duplicate **2** ``||math:map from to||`` blocks from ``||variables:set currFreq||`` and place one in the `start frequency` value and the other in the `end frequency` value. Change the acceleration direction in the `end frequency` value to the `y` direction.
44
+
45
+ ```blocks
46
+ let currFreq = 0
47
+ let lastFreq = 0
48
+ basic.forever(function () {
49
+ currFreq = Math.map(input.acceleration(Dimension.X), -1024, 1023, 0, 5000)
50
+ music.playSoundEffect(music.createSoundEffect(WaveShape.Sine,
51
+ Math.map(input.acceleration(Dimension.X), -1024, 1023, 0, 5000),
52
+ Math.map(input.acceleration(Dimension.Y), -1024, 1023, 0, 5000),
53
+ 255,
54
+ 0,
55
+ 500,
56
+ SoundExpressionEffect.None, InterpolationCurve.Linear), SoundExpressionPlayMode.UntilDone)
57
+ lastFreq = currFreq
58
+ })
59
+ ```
60
+
61
+ ## Add duration and volume
62
+
63
+ Click the **(+)** symbol again on the sound effect block inside of ``||music:play sound until done||``. This will show the volume parameters.
64
+
65
+ Pull out **3** ``||math:pick random||`` blocks and put them in for the values of `duration`, `start volume`, and `end volume`. For `duration`, use a range of `40` to `100`. For both `start volume` and `end volume`, use a random range of `0` to `1024`.
66
+
67
+ ```blocks
68
+ let currFreq = 0
69
+ let lastFreq = 0
70
+ basic.forever(function () {
71
+ currFreq = Math.map(input.acceleration(Dimension.X), -1024, 1023, 0, 5000)
72
+ music.playSoundEffect(music.createSoundEffect(WaveShape.Sine,
73
+ Math.map(input.acceleration(Dimension.X), -1024, 1023, 0, 5000),
74
+ Math.map(input.acceleration(Dimension.Y), -1024, 1023, 0, 5000),
75
+ randint(0, 1024),
76
+ randint(0, 1024),
77
+ randint(40, 100),
78
+ SoundExpressionEffect.None, InterpolationCurve.Linear), SoundExpressionPlayMode.UntilDone)
79
+ lastFreq = currFreq
80
+ })
81
+ ```
82
+
83
+ ## Set the effects
84
+
85
+ Once again, click the **(+)** symbol again on the sound effect block inside of ``||music:play sound until done||``. The effects parameters will appear. Change the setting for `effect` to `vibrato` and change `interpolation` to `curve`.
86
+
87
+
88
+ ```blocks
89
+ let currfreq = 0
90
+ let lastfreq = 0
91
+ basic.forever(function () {
92
+ currfreq = Math.map(input.acceleration(Dimension.X), -1024, 1023, 1, 5000)
93
+ music.playSoundEffect(music.createSoundEffect(
94
+ WaveShape.Sine,
95
+ Math.map(input.acceleration(Dimension.X), -1024, 1023, 1, 5000),
96
+ Math.map(input.acceleration(Dimension.Y), -1024, 1023, 1, 5000),
97
+ randint(0, 1024),
98
+ randint(0, 1024),
99
+ randint(40, 100),
100
+ SoundExpressionEffect.Vibrato,
101
+ InterpolationCurve.Curve
102
+ ),
103
+ SoundExpressionPlayMode.UntilDone)
104
+ lastfreq = currfreq
105
+ })
106
+ ```
107
+
108
+ ## Birds are singing!
109
+
110
+ Transfer you program to the @boardname@, shake and tilt it. The birds are singing!
@@ -20,5 +20,15 @@ Get your headphone and let's do music!
20
20
  "url":"/projects/guitar",
21
21
  "description": "An awesome cardboard guitar project, get ready to riff!",
22
22
  "imageUrl":"/static/mb/projects/guitar.png"
23
+ }, {
24
+ "name": "Jonny's Bird",
25
+ "url":"/projects/jonnys-bird",
26
+ "description": "Shake and tilt to make incredible bird sounds!",
27
+ "imageUrl":"/static/mb/projects/jonnys-bird.png"
28
+ }, {
29
+ "name": "Electric Guitar",
30
+ "url":"/projects/electric-guitar",
31
+ "description": "Make an electric guitar that you can play real chords with using the micro:bit!",
32
+ "imageUrl":"/static/mb/projects/electric-guitar.png"
23
33
  }]
24
34
  ```
@@ -203,7 +203,7 @@ basic.forever(function () {
203
203
  basic.forever(function () {
204
204
  if (state == REDLIGHT) {
205
205
  movement = Math.abs(input.acceleration(Dimension.Strength) - 1000)
206
- if (movement != 0) {
206
+ if (movement > 100) {
207
207
  game.gameOver()
208
208
  }
209
209
  }
package/docs/projects.md CHANGED
@@ -73,6 +73,11 @@
73
73
  "url": "/jacdac",
74
74
  "imageUrl": "/static/jacdac/getting-started.jpg"
75
75
  },
76
+ {
77
+ "name": "MicroCode for the new micro:bit (V2)",
78
+ "url": "/microcode",
79
+ "imageUrl": "/static/microcode/home.png"
80
+ },
76
81
  {
77
82
  "name": "Behind the MakeCode Hardware",
78
83
  "url": "/behind-the-makecode-hardware",
@@ -117,6 +122,7 @@
117
122
  [Blocks to JavaScript](/courses/blocks-to-javascript),
118
123
  [Courses](/courses),
119
124
  [Jacdac](/jacdac),
125
+ [MicroCode for the new micro:bit (V2)](/microcode),
120
126
  [Behind the MakeCode Hardware](/behind-the-makecode-hardware),
121
127
  [Science Experiments](/science-experiments),
122
128
  [Coding for Teachers](/coding-for-teachers),
@@ -1,17 +1,11 @@
1
1
  # Beat
2
2
 
3
- Returns the duration of a beat in milli-seconds
3
+ Returns the duration of a beat in milliseconds
4
4
 
5
5
  ```sig
6
6
  music.beat(BeatFraction.Whole)
7
7
  ```
8
8
 
9
- ## ~ hint
10
-
11
- **Simulator**: This function only works on the @boardname@ and in some browsers.
12
-
13
- ## ~
14
-
15
9
  ## Parameters
16
10
 
17
11
  * ``BeatFraction`` means fraction of a beat (BeatFraction.Whole, BeatFraction.Sixteenth etc)
@@ -7,11 +7,13 @@ faster or slower by the amount you say.
7
7
  music.changeTempoBy(20)
8
8
  ```
9
9
 
10
- ## ~ hint
10
+ ### ~hint
11
11
 
12
- **Simulator**: This function only works on the @boardname@ and in some browsers.
12
+ #### Simulator
13
13
 
14
- ## ~
14
+ ``||music:change tempo by||`` works on the @boardname@. It might not work in the simulator on every browser.
15
+
16
+ ### ~
15
17
 
16
18
  ## Parameters
17
19
 
@@ -1,39 +1,52 @@
1
1
  # Play Tone
2
2
 
3
- Play a musical tone through pin ``P0`` of the @boardname@ for as long as you say.
4
-
5
- ## ~ hint
6
-
7
- This function only works on the @boardname@ and in some browsers.
8
-
9
- ## ~
3
+ Play a musical tone on the speaker or at a sound pin of the @boardname@ for as long as you say.
10
4
 
11
5
  ```sig
12
6
  music.playTone(440, 120)
13
7
  ```
8
+ The frequency of the tone is set as a number of cycle per second, or Hertz. The [note frequency](/reference/music/note-frequency) block will allow you to use a musical note for the tone instead of a number of Hertz.
9
+
10
+ The duration of the tone is set as a number of milliseconds. It's typical though to use a number of beats or a beat fraction for the tone duration instead. The ``||music:beat||`` block is used to convert beats to milliseconds. You can also make a custom duration by just setting the tone duration to certain amount of milliseconds.
11
+
12
+ ### ~hint
13
+
14
+ #### Simulator
15
+
16
+ The ``||music:play tone||`` block works on the @boardname@ board. It might not work in the simulator on every browser.
17
+
18
+ ### ~
14
19
 
15
20
  ## Parameters
16
21
 
17
- * ``frequency`` is the [number](/types/number) of Hertz (how high or low the tone is).
18
- * ``ms`` is the [number](/types/number) of milliseconds that the tone lasts
22
+ * **frequency** is the [number](/types/number) of Hertz (how high or low the tone is). You can set this value with a note instead by using the [note frequency](/reference/music/note-frequency) block.
23
+ * **ms** is the [number](/types/number) of milliseconds for the duration of the tone. A [beat](/reference/music/beat) value is used instead as the block's default tone duration. The number of beats is converted to milliseconds for you.
24
+
19
25
 
20
26
  ## Example
21
27
 
22
- This example stores the musical note C in the variable `freq`.
23
- Next, it plays that note for 1000 milliseconds (one second).
28
+ ### Tone and beat
29
+
30
+ Play a `Middle C` for `1 beat`.
24
31
 
25
32
  ```blocks
26
- let freq = music.noteFrequency(Note.C)
27
- music.playTone(freq, 1000)
33
+ music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Whole))
28
34
  ```
29
35
 
36
+ ### Custom tone frequency and duration
37
+
38
+ Play a `250` Hertz tone for `1000` milliseconds.
39
+
40
+ ```blocks
41
+ music.playTone(250, 1000)
42
+ ```
30
43
 
31
44
  ## Using other pins
32
45
 
33
- Use [analogSetPitchPin](/reference/pins/analog-set-pitch-pin) to change that pin used to generate music.
46
+ Use [analogSetPitchPin](/reference/pins/analog-set-pitch-pin) to change the pin used to generate music.
34
47
 
35
48
  ```blocks
36
- pins.analogSetPitchPin(AnalogPin.P1);
49
+ pins.analogSetPitchPin(AnalogPin.P1)
37
50
  ```
38
51
 
39
52
  ## See also
@@ -1,29 +1,47 @@
1
1
  # Rest
2
2
 
3
- Rest (play no sound) through pin `PO` for the amount of time you say.
3
+ Play no sound (rest) on the speaker or at a sound pin for the amount of time you say.
4
4
 
5
5
  ```sig
6
6
  music.rest(400)
7
7
  ```
8
8
 
9
- ### ~ hint
9
+ The duration of the rest is set as a number milliseconds. Instead, it's typical to use a number of beats or a beat fraction for a rest. The ``||music:beat||`` block is used to convert beats to milliseconds. You can also make a custom rest by setting the rest duration to certain amount of milliseconds.
10
10
 
11
- **Simulator**: This function only works on the @boardname@ and in some browsers.
11
+ ### ~hint
12
12
 
13
- ## ~
13
+ #### Simulator
14
+
15
+ The ``||music:rest||`` block works on the @boardname@ board. It might not work in the simulator on every browser.
16
+
17
+ ### ~
14
18
 
15
19
  ## Parameters
16
20
 
17
- * ``ms`` is a [number](/types/number) saying how many
18
- milliseconds the @boardname@ should rest. One second is 1000
19
- milliseconds.
21
+ * **ms** is the [number](/types/number) of milliseconds for the duration of the rest. A [beat](/reference/music/beat) value is used instead as the block's default rest duration. The number of beats is converted to milliseconds for you.
20
22
 
21
23
  ## Example
22
24
 
25
+ ### Middle C loop
26
+
27
+ Continuously play a `Middle C` tone for `1` beat and rest for `2` beats.
28
+
29
+ ```blocks
30
+ basic.forever(function () {
31
+ music.playTone(262, music.beat(BeatFraction.Whole))
32
+ music.rest(music.beat(BeatFraction.Double))
33
+ })
34
+ ```
35
+
36
+ ### Custom rest time
37
+
38
+ Continuously play a `Middle C` note followed by a random rest time.
39
+
23
40
  ```blocks
24
- let frequency = music.noteFrequency(Note.C)
25
- music.playTone(frequency, 1000)
26
- music.rest(1000)
41
+ basic.forever(function () {
42
+ music.playTone(262, music.beat(BeatFraction.Whole))
43
+ music.rest(randint(500, 2000))
44
+ })
27
45
  ```
28
46
 
29
47
  ## See also
@@ -1,22 +1,23 @@
1
1
  # Ring Tone
2
2
 
3
- Play a musical tone through pin `P0` with the pitch as high or low as you say.
4
- The tone will keep playing until you tell it not to.
3
+ Play a musical tone on the speaker or at a sound pin of the @boardname@ with the pitch as high or low as you say. The tone will keep playing until you tell it not to.
5
4
 
6
5
  ```sig
7
6
  music.ringTone(440)
8
7
  ```
9
8
 
10
- ## ~ hint
9
+ ### ~hint
11
10
 
12
- **Simulator**: This function only works on the @boardname@ and in some browsers.
11
+ #### Simulator
13
12
 
14
- ## ~
13
+ The ``||music:ring tone||`` block works on the @boardname@ board. It might not work in the simulator on every browser.
14
+
15
+ ### ~
15
16
 
16
17
  ## Parameters
17
18
 
18
19
  * ``frequency`` is a [number](/types/number) that says
19
- how high-pitched or low-pitched the tone is. This
20
+ how high-pitched or low-pitched the tone is. This
20
21
  number is in **Hz** (**Hertz**), which is a measurement of frequency
21
22
  or pitch.
22
23
 
@@ -5,11 +5,15 @@ Makes the tempo (speed of a piece of music) as fast or slow as you say.
5
5
  ```sig
6
6
  music.setTempo(60)
7
7
  ```
8
- ## ~ hint
9
8
 
10
- **Simulator**: This function only works on the @boardname@ and in some browsers.
9
+ ### ~hint
10
+
11
+ #### Simulator
12
+
13
+ ``||music:set tempo||`` works on the @boardname@. It might not work in the simulator on every browser.
14
+
15
+ ### ~
11
16
 
12
- ## ~
13
17
 
14
18
  ## Parameters
15
19