pxt-microbit 5.1.31 → 5.1.33

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 (36) hide show
  1. package/built/editor.js +8 -1
  2. package/built/hexcache/{550de46760eef39e83ea3c0dedc62143c0a9edd89048a4431b7f7ebe24c138bc.hex → 96edf84d82a943dfeaf8eb875ebe2450269f35252929755be2403c8192dea82d.hex} +9648 -9658
  3. package/built/hexcache/{9cd7c257ed93c352013ffe57772f65d13ef250b70c03274784786a2e58201b00.hex → 9ea1973c7762e7aecdc31dadd748bc7388bec2467a2c209768755435de96c4ad.hex} +10223 -10233
  4. package/built/sim.js +3 -0
  5. package/built/target.js +1 -1
  6. package/built/target.json +1 -1
  7. package/built/targetlight.json +1 -1
  8. package/built/theme.json +1 -1
  9. package/built/web/rtlsemantic.css +1 -1
  10. package/built/web/semantic.css +1 -1
  11. package/docs/projects/7-seconds.md +5 -1
  12. package/docs/projects/coin-flipper.md +9 -5
  13. package/docs/projects/compass.md +27 -23
  14. package/docs/projects/dice.md +9 -5
  15. package/docs/projects/flashing-heart.md +4 -0
  16. package/docs/projects/hot-potato.md +4 -0
  17. package/docs/projects/level.md +3 -0
  18. package/docs/projects/love-meter.md +13 -9
  19. package/docs/projects/micro-chat.md +7 -3
  20. package/docs/projects/name-tag.md +9 -5
  21. package/docs/projects/plot-acceleration.md +4 -0
  22. package/docs/projects/rock-paper-scissors-v2.md +5 -1
  23. package/docs/projects/rock-paper-scissors.md +11 -7
  24. package/docs/projects/smiley-buttons.md +11 -8
  25. package/docs/projects/stopwatch.md +5 -1
  26. package/docs/projects/v2-blow-away.md +28 -88
  27. package/docs/projects/v2-cat-napping.md +51 -72
  28. package/docs/projects/v2-clap-lights.md +16 -50
  29. package/docs/projects/v2-countdown.md +15 -47
  30. package/docs/projects/v2-morse-chat.md +55 -60
  31. package/docs/projects/v2-pet-hamster.md +16 -50
  32. package/docs/tours/editor-tour.md +6 -0
  33. package/package.json +2 -2
  34. package/pxtarget.json +2 -1
  35. /package/built/hexcache/{90a043ede557d6bcd7ed8cc81981423d585f2a35ae7aece873225bfd39fd4e0f.hex → 282178dff5d09bc8cff46b9f8e533eb93524dadf852327e64d964046add37c4a.hex} +0 -0
  36. /package/built/hexcache/{fe0a5660d2c5ff7a892a8ee5a19cf1de8778194633607826adde4a6b48ff3835.hex → 8f2625e2eca3b2d07c3b3c15e47e92ae7a5652aaa937806bf27061b622aa3cbd.hex} +0 -0
@@ -1,6 +1,6 @@
1
1
  # Blow Away
2
2
 
3
- ## 1. Introduction pt. 1 @unplugged
3
+ ## Introduction pt. 1 @unplugged
4
4
 
5
5
  👻 Oh, no! Your @boardname@ is being haunted by a ghost named Haven 👻
6
6
 
@@ -8,16 +8,11 @@ For this tutorial, we'll learn how to blow Haven away 🌬️
8
8
 
9
9
  ![Blow away banner message](/static/mb/projects/blow-away.png)
10
10
 
11
- ## 2. Haunted ghost setup
12
-
13
- 🏚️ **BooOooOoo** 🏚️
11
+ ## Haunted ghost setup
14
12
 
15
13
  A wild Haven has appeared!
16
14
 
17
- ---
18
-
19
- ► From the ``||basic:Basic||`` category, find ``||basic:show icon [ ]||`` and add it to your ``||basic:on start||`` container.
20
-
15
+ ► From the ``||basic:Basic||`` category, find ``||basic:show icon [ ]||`` and add it to your ``||basic:on start||`` container.
21
16
  ► Click the heart icon and set it to show a ghost.
22
17
  💡 In the ``show icon`` dropdown menu options, you can hover to see what each design is called.
23
18
 
@@ -28,11 +23,7 @@ basic.showIcon(IconNames.Ghost)
28
23
 
29
24
  ---
30
25
 
31
- ## 3. Loop setup
32
-
33
- ➰ **Looping around** ➰
34
-
35
- ---
26
+ ## Loop setup
36
27
 
37
28
  ► From the ``||loops:Loops||`` category, find the ``||loops:repeat [4] times||`` loop and snap it into your empty ``||basic:forever||`` container.
38
29
  💡 Why do we need a [__*repeat loop*__](#repeatLoop "repeat code for a given number of times") when we already have a ``forever`` container? Because ``forever`` has an embedded delay that we want to avoid!
@@ -46,18 +37,12 @@ basic.forever(function () {
46
37
  })
47
38
  ```
48
39
 
49
- ## 4. Conditional setup
50
-
51
- 🤔 **Conditioning and comparing** 🤔
40
+ ## Conditional setup
52
41
 
53
42
  Haven hates noise and will blow away if things get too loud. Let's use an [__*if statement*__](#ifstatement "if this condition is met, do something") to check for sounds.
54
43
 
55
- ---
56
-
57
- ► From ``||logic:Logic||``, grab an ``||logic:if <true> then||`` statement and snap it into your empty ``||loops:repeat [4] times do||`` loop.
58
-
59
- ► Go back to ``||logic:Logic||`` to get a ``||logic:<[0] [=] [0]>||`` comparison.
60
-
44
+ ► From ``||logic:Logic||``, grab an ``||logic:if <true> then||`` statement and snap it into your empty ``||loops:repeat [4] times do||`` loop.
45
+ ► Go back to ``||logic:Logic||`` to get a ``||logic:<[0] [=] [0]>||`` comparison.
61
46
  ► Snap ``||logic:<[0] [=] [0]>||`` in to **replace** the ``||logic:<true>||`` condition for your ``||logic:if then||`` statement.
62
47
 
63
48
  ```blocks
@@ -72,18 +57,12 @@ basic.forever(function () {
72
57
  })
73
58
  ```
74
59
 
75
- ## 5. Blow sound
76
-
77
- 👂 **Haven's ears** 👂
60
+ ## Blow sound
78
61
 
79
62
  We'll be using a [__*sound threshold*__](#soundThreshold "a number for how loud a sound needs to be to trigger an event. 0 = silence to 255 = maximum noise") to act as Haven's ears.
80
63
 
81
- ---
82
-
83
- ► From the ``||input:Input||`` category, drag ``||input:sound level||`` in to **replace** the **_left_ ``0``** of your ``||logic:<[0] [=] [0]>||`` comparison.
84
-
85
- ► Using the dropdown in the **middle** of ``||logic:[sound level] [=] [0]||``, change the comparison to be **``>``** (greater than).
86
-
64
+ ► From the ``||input:Input||`` category, drag ``||input:sound level||`` in to **replace** the **_left_ ``0``** of your ``||logic:<[0] [=] [0]>||`` comparison.
65
+ ► Using the dropdown in the **middle** of ``||logic:[sound level] [=] [0]||``, change the comparison to be **``>``** (greater than).
87
66
  ► Finally, have the **right side** of the comparison say ``128`` so your full comparison reads: **``sound level > 128``**.
88
67
  💡 This means Haven will hear any sound above ``128``.
89
68
 
@@ -98,31 +77,20 @@ basic.forever(function () {
98
77
  })
99
78
  ```
100
79
 
101
- ## 6. Making variables
102
-
103
- ☀️ **Variable weather** 🌨️
80
+ ## Making variables
104
81
 
105
82
  Let's create some [__*variables*__](#variable "a holder for information that may change") to keep track of Haven's movement.
106
83
 
107
- ---
108
-
109
84
  ► In the ``||variables:Variables||`` category, click on ``Make a Variable...`` and make a variable named ``col``.
110
- 💡 ``col`` is short for "column".
111
-
85
+ 💡 ``col`` is short for "column".
112
86
  ► Make **another** variable and name it ``row``.
113
87
 
114
- ## 7. Displacing LEDs part 1
115
-
116
- 🔀 **Random chance** 🔀
88
+ ## Displacing LEDs part 1
117
89
 
118
90
  To show Haven is blowing away, we want to move a random set of lights sideways.
119
91
 
120
- ---
121
-
122
- ► Your ``||variables:Variables||`` category should now have the option to ``||variables:set [row] to [0]||``. Drag that block into your empty ``||logic:if then||`` statement.
123
-
124
- ► From the ``||math:Math||`` category, find ``||math:pick random [0] to [10]||`` and snap that in to **replace** the ``[0]`` in your ``||variables:set [row] to [0]||`` block.
125
-
92
+ ► Your ``||variables:Variables||`` category should now have the option to ``||variables:set [row] to [0]||``. Drag that block into your empty ``||logic:if then||`` statement.
93
+ ► From the ``||math:Math||`` category, find ``||math:pick random [0] to [10]||`` and snap that in to **replace** the ``[0]`` in your ``||variables:set [row] to [0]||`` block.
126
94
  ► Change the maximum number from ``10`` to **``4``**.
127
95
  💡 We are setting the maximum random value to 4 because the lights on the @boardname@ are numbered 0, 1, 2, 3, and 4 for columns and rows.
128
96
 
@@ -138,14 +106,11 @@ basic.forever(function () {
138
106
  })
139
107
  ```
140
108
 
141
- ## 8. Displacing LEDs part 2
142
-
143
- ► Go back into ``||variables:Variables||`` and drag out another ``||variables:set [row] to [0]||``. Place this one below the last one (at **the end**) of your `if then` statement.
144
-
145
- ► Using the **dropdown menu**, set the new block to read ``||variables:set [col] to [0]||``.
146
-
147
- ► From the ``||math:Math||`` category, grab another ``||math:pick random [0] to [10]||`` and snap that in to **replace** the ``[0]`` in your ``||variables:set [col] to [0]||`` block.
109
+ ## Displacing LEDs part 2
148
110
 
111
+ ► Go back into ``||variables:Variables||`` and drag out another ``||variables:set [row] to [0]||``. Place this one below the last one (at **the end**) of your `if then` statement.
112
+ ► Using the **dropdown menu**, set the new block to read ``||variables:set [col] to [0]||``.
113
+ ► From the ``||math:Math||`` category, grab another ``||math:pick random [0] to [10]||`` and snap that in to **replace** the ``[0]`` in your ``||variables:set [col] to [0]||`` block.
149
114
  ► Change the maximum number from ``10`` to **``4``**.
150
115
 
151
116
  ```blocks
@@ -162,16 +127,11 @@ basic.forever(function () {
162
127
  })
163
128
  ```
164
129
 
165
- ## 9. Conditioning on one point
166
-
167
- ✨ **Ooh, sparkly** ✨
130
+ ## Conditioning on one point
168
131
 
169
132
  Time to move some lights around!
170
133
 
171
- ---
172
-
173
- ► From ``||logic:Logic||``, grab another ``||logic:if <true> then||`` and snap it at the **inside and at the bottom of** your ``||loops:repeat [4] times do||`` loop, right below your ``||logic:if [sound level] [>] [128]||`` statement.
174
-
134
+ ► From ``||logic:Logic||``, grab another ``||logic:if <true> then||`` and snap it at the **inside and at the bottom of** your ``||loops:repeat [4] times do||`` loop, right below your ``||logic:if [sound level] [>] [128]||`` statement.
175
135
  ► From the ``||led:Led||`` category, find ``||led:point x [0] y [0]||`` and drag it in to **replace** the ``||logic:<true>||`` condition in the **new** ``||logic:if then||`` statement.
176
136
  💡 This block will test if the light is on at the the given ``x`` and ``y`` coordinate points.
177
137
 
@@ -190,14 +150,11 @@ basic.forever(function () {
190
150
  })
191
151
  ```
192
152
 
193
- ## 10. Unplotting and replotting LEDs
153
+ ## Unplotting and replotting LEDs
194
154
 
195
155
  To create the animation effect of Haven blowing away, we will turn off (or ``unplot``) a light that is on and then turn it on again (``plot`` it) in a different spot.
196
156
 
197
- ---
198
-
199
- ► From ``||led:Led||``, grab ``||led:unplot x [0] y [0]||`` and snap it inside the **empty** ``||logic:if <point x [0] y [0]> then||`` statement.
200
-
157
+ ► From ``||led:Led||``, grab ``||led:unplot x [0] y [0]||`` and snap it inside the **empty** ``||logic:if <point x [0] y [0]> then||`` statement.
201
158
  ► Go back to ``||led:Led||`` and get ``||led:plot x [0] y [0]||``. Snap that in **beneath** the ``||led:unplot x [0] y [0]||`` block that you just added.
202
159
 
203
160
  ```blocks
@@ -220,17 +177,11 @@ basic.forever(function () {
220
177
 
221
178
  ## 11. Setting variables
222
179
 
223
- 📃 **Columns and rows** 📃
224
-
225
- Notice how you have **three** blocks from the ``||led:Led||`` category. All three have ``||led:x||`` ``[0]`` and ``||led:y||`` ``[0]`` coordinates. In these **two** steps, we will set it so that every ``||led:x||`` is followed by the ``||variables:col||`` variable and every ``||led:y||`` is followed by the ``||variables:row||`` variable.
226
-
227
- ---
228
-
180
+ Notice how you have **three** blocks from the ``||led:Led||`` category. All three have ``||led:x||`` ``[0]`` and ``||led:y||`` ``[0]`` coordinates. In these **two** steps, we will set it so that every ``||led:x||`` is followed by the ``||variables:col||`` variable and every ``||led:y||`` is followed by the ``||variables:row||`` variable.
229
181
  ► From ``||variables:Variables||``, get three copies of ``||variables:col||``, and use them to **replace the ``x`` values** in the following three blocks:
230
182
  **1.** ``||led:point x [0] y [0]||``
231
183
  **2.** ``||led:unplot x [0] y [0]||``
232
- **3.** ``||led:plot x [0] y [0]||``
233
-
184
+ **3.** ``||led:plot x [0] y [0]||``
234
185
  ► Go into ``||variables:Variables||``, get three copies of ``||variables:row||``, and use them to **replace the ``y`` values** in the same three blocks.
235
186
 
236
187
  ```blocks
@@ -253,17 +204,11 @@ basic.forever(function () {
253
204
 
254
205
  ## 12. Moving LEDs
255
206
 
256
- ➕ **Math makes the lights go swoosh** ➗
257
-
258
207
  Right now, we are unplotting and replotting in the same spot. What we want to do is move the lights we're turning back on just a smidge to the right every time until there's nothing left on the grid.
259
208
 
260
- ---
261
-
262
209
  ► From ``||math:Math||``, find the ``||math:[0] [+] [0]||`` operation and use it to **replace** ``||variables:col||`` in your ``||led:plot x [col] y [row]||`` block.
263
- 💡 If you move your entire ``||basic:forever||`` container, you should find a greyed out ``col`` variable in your workspace.
264
-
265
- ► Take the greyed out ``||variables:col||`` variable (or get a new one) and use it to **replace** the **_first_ ``[0]``** so the operation reads ``||math:[col] [+] [0]||``.
266
-
210
+ 💡 If you move your entire ``||basic:forever||`` container, you should find a greyed out ``col`` variable in your workspace.
211
+ ► Take the greyed out ``||variables:col||`` variable (or get a new one) and use it to **replace** the **_first_ ``[0]``** so the operation reads ``||math:[col] [+] [0]||``.
267
212
  ► Replace the **_second_ ``[0]``** with **``[1]``** so the operation reads ``||math:[col] [+] [1]||``.
268
213
 
269
214
  ```blocks
@@ -286,14 +231,9 @@ basic.forever(function () {
286
231
 
287
232
  ## 13. Testing in the simulator
288
233
 
289
- 🌬️ **Test what you've created** 👻
290
-
291
234
  Check out the simulator!
292
235
 
293
- ---
294
-
295
- ► Click on the pink bar underneath the microphone icon. Drag it above the sound number you chose (we used ``128``!) to blow Haven away.
296
-
236
+ ► Click on the pink bar underneath the microphone icon. Drag it above the sound number you chose (we used ``128``!) to blow Haven away.
297
237
  ► If you have a new @boardname@ (the one with the **shiny gold** logo at the top), download this code and try it out!
298
238
  💡 Blow close to the @boardname@ and watch Haven swoosh away 💨
299
239
  💡 Use your @boardname@'s reset button (it's on the back!) to bring Haven back 👻
@@ -1,23 +1,17 @@
1
1
  # Cat Napping
2
2
 
3
- ## 1. Introduction @unplugged
3
+ ## Introduction @unplugged
4
4
 
5
5
  Lychee the cat loves the sun and wants to know if your home has a good sunbathing spot. Are you up for the challenge?
6
6
 
7
7
  ![Cat Tanning banner message, an image of a cat](/static/mb/projects/cat-napping/1_lychee.png)
8
8
 
9
- ## 2. Setting logging to false on start
10
-
11
- 📋 **Variable data** 📋
9
+ ## Setting logging to false on start
12
10
 
13
11
  First, we want to make sure we know when our micro:bit is collecting data. To do this, let's create a [__*boolean*__](#boolean "something that is only true or false") [__*variable*__](#variable "a holder for information that may change") and use it to track when the @boardname@ is logging data. We'll start with the logging variable set to false.
14
12
 
15
- ---
16
-
17
- ► In the ``||variables:Variables||`` category, click on ``Make a Variable...`` and make a variable named ``logging``.
18
-
19
- ► From the ``||variables:Variables||`` category, grab the ``||variables:set [logging] to [0]||`` block and snap it into the empty ``||basic:on start||`` container.
20
-
13
+ ► In the ``||variables:Variables||`` category, click on ``Make a Variable...`` and make a variable named ``logging``.
14
+ ► From the ``||variables:Variables||`` category, grab the ``||variables:set [logging] to [0]||`` block and snap it into the empty ``||basic:on start||`` container.
21
15
  ► From the ``||logic:Logic||`` category, grab a ``||logic:<false>||`` argument and snap it in to **replace** the ``||variables:[0]||`` value in your ``||variables:set [logging] to [0]||`` statement.
22
16
 
23
17
  ```blocks
@@ -25,21 +19,12 @@ let logging = false
25
19
  logging = false
26
20
  ```
27
21
 
28
- ## 3. Toggle logging on A press
29
-
30
- ▶️ **Starting and stopping** ⏸️
22
+ ## Toggle logging on A press
31
23
 
32
24
  Let's give Lychee some control over when she wants to start and stop logging data on the @boardname@.
33
25
 
34
- ---
35
-
36
- ► From the ``||input:Input||`` category, grab a ``||input:on button [A] pressed||`` container and drag it into your workspace.
37
-
38
- ► From the ``||variables:Variables||`` category, grab a ``||variables:set [logging] to [0]||`` block and snap it inside of your ``||input:on button [A] pressed||`` container.
39
-
40
- ► From the ``||logic:Logic||`` category, grab a ``||logic:<not []>||`` argument and snap it in to **replace** the ``0`` argument.
41
-
42
- ► From the ``||variables:Variables||`` category, grab a ``||variables:logging||`` variable and snap it in to **replace** the empty ``||logic:<>||`` in the ``||logic:not <>||`` statement.
26
+ ► From the ``||input:Input||`` category, grab a ``||input:on button [A] pressed||`` container and drag it into your workspace. Then, grab a ``||variables:set [logging] to [0]||`` block from ``||variables:Varables||`` and snap it inside of your ``||input:on button [A] pressed||`` container.
27
+ ► From the ``||logic:Logic||`` category, grab a ``||logic:<not []>||`` argument and snap it in to **replace** the ``0`` argument. Go back to the ``||variables:Variables||`` category, grab a ``||variables:logging||`` variable and snap it in to **replace** the empty ``||logic:<>||`` in the ``||logic:not <>||`` statement.
43
28
 
44
29
  ✋🛑 Take a moment to help Lychee answer the following question: _What is happening every time she presses the A button?_
45
30
 
@@ -50,21 +35,27 @@ input.onButtonPressed(Button.A, function () {
50
35
  })
51
36
  ```
52
37
 
53
- ## 4. Visual logging indicators
54
-
55
- 👀 **Visual indicators** 👀
38
+ ## Visual logging indicators
56
39
 
57
40
  It would help to know when the @boardname@ is logging data and when it isn't. For this step, we will be building out a visual indicator using an [__*if then / else*__](#ifthenelse "runs some code if a boolean condition is true and different code if the condition is false") statement.
58
41
 
59
- ---
60
-
61
- ► From the ``||logic:Logic||`` category, grab an ``||logic:if <true> then / else||`` statement and snap it in at the **bottom** of your ``||input:on button [A] pressed||`` container.
42
+ ► From the ``||logic:Logic||`` category, grab an ``||logic:if <true> then / else||`` statement and snap it in at the **bottom** of your ``||input:on button [A] pressed||`` container.
43
+ ► From ``||variables:Variables||``, grab a ``||variables:logging||`` variable and snap it in to **replace** the ``||logic:<true>||`` condition in your ``||logic:if then / else||`` statement.
62
44
 
63
- ► From ``||variables:Variables||``, grab a ``||variables:logging||`` variable and snap it in to **replace** the ``||logic:<true>||`` condition in your ``||logic:if then / else||`` statement.
45
+ ```blocks
46
+ let logging = false
47
+ input.onButtonPressed(Button.A, function () {
48
+ logging = !(logging)
49
+ if (logging) {
50
+ } else {
51
+ }
52
+ })
53
+ ```
64
54
 
65
- Let's display an image when the @boardname@ is logging data. From the ``||basic:Basic||`` category, grab a ``||basic:show icon []||`` block and snap it into the empty **top container** of your ``||logic:if then / else||`` statement.
55
+ ## Set the indicator icon
66
56
 
67
- Set it to show the "target" icon (it looks like an empty sun - scroll down to find it!). This will show whenever your @boardname@ is collecting data. <br />
57
+ Let's display an image when the @boardname@ is logging data. From the ``||basic:Basic||`` category, grab a ``||basic:show icon []||`` block and snap it into the empty **top container** of your ``||logic:if then / else||`` statement.
58
+ ► Set it to show the "target" icon (it looks like an empty sun - scroll down to find it!). This will show whenever your @boardname@ is collecting data.
68
59
  💡 In the ``show icon`` dropdown menu options, you can hover to see what each design is called.
69
60
 
70
61
  ```blocks
@@ -78,15 +69,26 @@ input.onButtonPressed(Button.A, function () {
78
69
  })
79
70
  ```
80
71
 
81
- ## 4. Auditory logging indicators
72
+ ## Auditory logging indicators
82
73
 
83
74
  Let's now add an auditory indicator that your @boardname@ is logging data!
84
75
 
85
- ---
76
+ ► From the ``||music:Music||`` category, grab a ``||music:play sound [giggle] [until done]||`` block and snap it into the **bottom** of the **top container** of your ``||logic:if then / else||`` statement.
77
+ ► Click on the ``giggle`` dropdown and select ``hello``. Your block should now say ``||music:play sound [hello] [until done]||``.
86
78
 
87
- ► From the ``||music:Music||`` category, grab a ``||music:play sound [giggle] [until done]||`` block and snap it into the **bottom** of the **top container** of your ``||logic:if then / else||`` statement.
79
+ ```blocks
80
+ let logging = false
81
+ input.onButtonPressed(Button.A, function () {
82
+ logging = !(logging)
83
+ if (logging) {
84
+ basic.showIcon(IconNames.Target)
85
+ music.playSoundEffect(music.builtinSoundEffect(soundExpression.hello), SoundExpressionPlayMode.UntilDone)
86
+ } else {
87
+ }
88
+ })
89
+ ```
88
90
 
89
- Click on the ``giggle`` dropdown and select ``hello``. Your block should now say ``||music:play sound [hello] [until done]||``.
91
+ ## Logging off indicator
90
92
 
91
93
  ► Let's clear the board when the @boardname@ is not logging data. From the ``||basic:Basic||`` category, grab a ``||basic:clear screen||`` block and snap it into the empty **bottom container** of your ``||logic:if then / else||`` statement.
92
94
 
@@ -103,16 +105,11 @@ input.onButtonPressed(Button.A, function () {
103
105
  })
104
106
  ```
105
107
 
106
- ## 5. Time interval for data logging
107
-
108
- 📈 **A data point a minute** 📈
108
+ ## Time interval for data logging
109
109
 
110
110
  Let's set up the data logging for Lychee! In order to get Lychee a good amount of data without running out of memory, we should collect one data point for her every minute.
111
111
 
112
- ---
113
-
114
- ► From the ``||loops:Loops||`` category, grab a ``||loops:every [500] ms||`` container and add it to your workspace.
115
-
112
+ ► From the ``||loops:Loops||`` category, grab a ``||loops:every [500] ms||`` container and add it to your workspace.
116
113
  ► Click on the the ``500`` dropdown and select ``1 minute``. <br />
117
114
  💡 1 minute is equivalent to 60000ms, which is what the number will automatically change to.
118
115
 
@@ -121,14 +118,11 @@ loops.everyInterval(60000, function () {
121
118
  })
122
119
  ```
123
120
 
124
- ## 6. Setting up a logging variable
121
+ ## Setting up a logging variable
125
122
 
126
123
  Now, let's use an [__*if then*__](#ifthen "runs some code if a boolean condition is true") statement to track when the @boardname@ is logging data.
127
124
 
128
- ---
129
-
130
- ► From the ``||logic:Logic||`` category, grab a ``||logic:if <true> then||`` statement and snap it into your ``||loops:every [600000] ms||`` container.
131
-
125
+ ► From the ``||logic:Logic||`` category, grab a ``||logic:if <true> then||`` statement and snap it into your ``||loops:every [600000] ms||`` container.
132
126
  ► From the ``||variables:Variables||`` category, drag out a ``||variables:logging||`` variable and snap it in to **replace** the ``||logic:<true>||`` argument in the ``||logic:if <true> then||`` statement.
133
127
 
134
128
  ```blocks
@@ -139,18 +133,12 @@ loops.everyInterval(60000, function () {
139
133
  })
140
134
  ```
141
135
 
142
- ## 7. Setting up logging - Part 1
143
-
144
- 🏁 **Ready...set...log!** 🏁
136
+ ## Setting up logging - Part 1
145
137
 
146
138
  Lychee loves her sun spots because they provide a nice, sunny and warm place to nap. So, we'll need to measure the **temperature** and **light** in different places around the house.
147
139
 
148
- ---
149
-
150
- ► From the ``||datalogger:Data Logger||`` category, grab a ``||datalogger:log data [column [""] value [0]] +||`` block and snap it **inside** the ``||logic:if [logging] then||`` statement.
151
-
152
- ► Click on the ``""`` after the word ``column`` and type in "``temp``".
153
-
140
+ ► From the ``||datalogger:Data Logger||`` category, grab a ``||datalogger:log data [column [""] value [0]] +||`` block and snap it **inside** the ``||logic:if [logging] then||`` statement.
141
+ ► Click on the ``""`` after the word ``column`` and type in "``temp``".
154
142
  ► From the ``||input:Input||`` category, select the ``||input:temperature (°C)||`` parameter and drag it in to **replace** the ``0`` after the word ``value``.
155
143
 
156
144
  ```blocks
@@ -165,12 +153,10 @@ loops.everyInterval(60000, function () {
165
153
  })
166
154
  ```
167
155
 
168
- ## 8. Setting up logging - Part 2
169
-
170
- ► On the right of the ``||input:temperature (°C)||`` input that you just snapped in, there is a ➕ button. Click on it. You should now see a new row that says ``||datalogger:column [""] value [0]||``.
171
-
172
- ► Click on the empty ``""`` after the word ``column`` and type in "``light``".
156
+ ## Setting up logging - Part 2
173
157
 
158
+ ► On the right of the ``||input:temperature (°C)||`` input that you just snapped in, there is a ➕ button. Click on it. You should now see a new row that says ``||datalogger:column [""] value [0]||``.
159
+ ► Click on the empty ``""`` after the word ``column`` and type in "``light``".
174
160
  ► From the ``||input:Input||`` category, select the ``||input:light level||`` parameter and drag it in to **replace** the ``0`` parameter after the word ``value``.
175
161
 
176
162
  ```blocks
@@ -186,21 +172,14 @@ loops.everyInterval(60000, function () {
186
172
  })
187
173
  ```
188
174
 
189
- ## 9. Time to log data! @unplugged
190
-
191
- 🎉 **Time to log data!** 🎉
175
+ ## Time to log data! @unplugged
192
176
 
193
177
  You did it! If you have a @boardname@ V2 (the one with the **shiny gold** logo at the top), download this code and try it out!
194
178
 
195
- ---
196
-
197
- ► Find a sun spot in your house and press the ``A`` button to start logging data - your display should show an icon and play a sound to indicate that you are logging data.
198
-
179
+ ► Find a sun spot in your house and press the ``A`` button to start logging data - your display should show an icon and play a sound to indicate that you are logging data.
199
180
  ► After some time (we recommend at least an hour), press the ``A`` button again to stop logging data - your display should clear to indicate that you are not logging data.
200
181
 
201
- ## 10. Reviewing your data @unplugged
202
-
203
- 🕵️ **Reviewing your data** 🕵️
182
+ ## Reviewing your data @unplugged
204
183
 
205
184
  Now that you have logged some data, plug your @boardname@ into a laptop or desktop computer. The @boardname@ will appear like a USB drive called MICROBIT. Look in there and you'll see a file called MY_DATA:
206
185
 
@@ -210,7 +189,7 @@ Double-click on MY_DATA to open it in a web browser and you'll see a table with
210
189
 
211
190
  ![Image of sample data file](/static/mb/projects/cat-napping/11_datafile.png)
212
191
 
213
- ## 11. Lychee's preferences @unplugged
192
+ ## Lychee's preferences @unplugged
214
193
 
215
194
  Does your home have a good sunbathing spot for Lychee? Compare the light and temperature levels you record for different areas around your house! The sunniest and warmest spots will likely be her favorite ☀️😻
216
195
 
@@ -1,6 +1,6 @@
1
1
  # Clap Lights
2
2
 
3
- ## 1. Introduction @unplugged
3
+ ## Introduction @unplugged
4
4
 
5
5
  The new @boardname@s have a microphone to help them detect sound 🎤
6
6
 
@@ -8,11 +8,7 @@ Let's learn how to use a clap 👏 to switch your @boardname@'s lights on and of
8
8
 
9
9
  ![Clap lights banner message](/static/mb/projects/clap-lights.png)
10
10
 
11
- ## 2. Setting up the sound input
12
-
13
- 🔊 **Reacting to sound** 🔊
14
-
15
- ---
11
+ ## Setting up the sound input
16
12
 
17
13
  ► From the ``||input:Input||`` category, find the ``||input:on [loud] sound||`` container and add it to your workspace.
18
14
 
@@ -22,26 +18,17 @@ input.onSound(DetectedSound.Loud, function () {
22
18
  })
23
19
  ```
24
20
 
25
- ## 3. Creating a lightsOn variable
26
-
27
- 🤿 **Diving right in** 🤿
21
+ ## Creating a lightsOn variable
28
22
 
29
23
  Let's begin by creating a [__*variable*__](#variable "a holder for information that may change") to keep track of whether the @boardname@'s lights are on or off.
30
24
 
31
- ---
32
-
33
25
  ► In the ``||variables:Variables||`` category, click on ``Make a Variable...`` and make a variable named ``lightsOn``.
34
26
 
35
- ## 4. Displaying LEDs part 1
36
-
37
- 🔆 **On or not?** 🌑
27
+ ## Displaying LEDs part 1
38
28
 
39
29
  In this step, we'll be using an [__*if then / else*__](#ifthenelse "runs some code if a Boolean condition is true and different code if the condition is false") statement.
40
30
 
41
- ---
42
-
43
- ► From the ``||logic:Logic||`` category, grab an ``||logic:if <true> then / else||`` block and snap it into your ``||input:on [loud] sound||`` container.
44
-
31
+ ► From the ``||logic:Logic||`` category, grab an ``||logic:if <true> then / else||`` block and snap it into your ``||input:on [loud] sound||`` container.
45
32
  ► Look in the ``||variables:Variables||`` category. Find the new ``||variables:lightsOn||`` variable and snap it in to **replace** the ``||logic:<true>||`` value in your ``||logic:if <true> then / else||`` statement.
46
33
 
47
34
  ```blocks
@@ -56,14 +43,9 @@ input.onSound(DetectedSound.Loud, function () {
56
43
  })
57
44
  ```
58
45
 
59
- ## 5. Displaying LEDs part 2
60
-
61
- 🌞 **Lighting the display** 🌞
62
-
63
- ---
64
-
65
- ► From ``||basic:Basic||``, grab ``||basic:show leds||`` and snap it into the **top container** of your ``||logic:if then / else||`` statement.
46
+ ## Displaying LEDs part 2
66
47
 
48
+ ► From ``||basic:Basic||``, grab ``||basic:show leds||`` and snap it into the **top container** of your ``||logic:if then / else||`` statement.
67
49
  ► Set the lights to a pattern you like!
68
50
  💡 In the hint, we chose to turn on all of the outside lights. Feel free to make your own design 🎨
69
51
 
@@ -84,7 +66,7 @@ input.onSound(DetectedSound.Loud, function () {
84
66
  })
85
67
  ```
86
68
 
87
- ## 6. Clearing the screen
69
+ ## Clearing the screen
88
70
 
89
71
  ► From ``||basic:Basic||``, find ``||basic:clear screen||`` and snap it into the **bottom container** of your ``||logic:if then / else||`` section.
90
72
  💡 This will turn the display off if ``lightsOn`` is **not** ``true``.
@@ -107,18 +89,12 @@ input.onSound(DetectedSound.Loud, function () {
107
89
  })
108
90
  ```
109
91
 
110
- ## 7. Setting the lightsOn variable
111
-
112
- 🎬 **Lights, camera, _action_** ✨
92
+ ## Setting the lightsOn variable
113
93
 
114
94
  Just like we'd toggle a light switch, each time we clap, we want to **flip** the variable ``lightsOn`` to the **opposite** of what it was before.
115
95
 
116
- ---
117
-
118
- ► From ``||variables:Variables||``, locate ``||variables:set [lightsOn] to [0]||`` and snap it in at the **very top** of your ``||input:on [loud] sound||`` container.
119
-
120
- ► From the ``||logic:Logic||`` category, find the ``||logic:not <>||`` operator and use it to **replace the ``[0]``** in ``||variables:set [lightsOn] to [0]||``.
121
-
96
+ ► From ``||variables:Variables||``, locate ``||variables:set [lightsOn] to [0]||`` and snap it in at the **very top** of your ``||input:on [loud] sound||`` container.
97
+ ► From the ``||logic:Logic||`` category, find the ``||logic:not <>||`` operator and use it to **replace the ``[0]``** in ``||variables:set [lightsOn] to [0]||``.
122
98
  ► From ``||variables:Variables||``, grab ``||variables:lightsOn||`` and snap it into the **empty part** of the ``||logic:not <>||`` operator.
123
99
 
124
100
  ```blocks
@@ -140,25 +116,17 @@ input.onSound(DetectedSound.Loud, function () {
140
116
  })
141
117
  ```
142
118
 
143
- ## 8. Testing in the simulator
144
-
145
- 💡 **Test what you've created** 💡
146
-
147
- ---
148
-
149
- ► Check out the simulator!
119
+ ## Testing in the simulator
150
120
 
121
+ ► Check out the simulator!
151
122
  ► Click on the pink slider bar beneath the microphone icon and drag it up and down.
152
123
  💡 Right now, your @boardname@ thinks that anything above 128 is loud. Every time the sound goes > 128, your lights should switch on/off.
153
124
 
154
- ## 8. Set loud sound threshold
125
+ ## Set loud sound threshold
155
126
 
156
127
  Your @boardname@ might detect sounds when you don't want it to. Setting a [__*sound threshold*__](#soundThreshold "a number for how loud a sound needs to be to trigger an event. 0 = silence to 255 = maximum noise") could help 🔉🔊
157
128
 
158
- ---
159
-
160
- ► Click on the ``||input:Input||`` category. A new category should show up beneath it called ``||input:...more||``.
161
-
129
+ ► Click on the ``||input:Input||`` category. A new category should show up beneath it called ``||input:...more||``.
162
130
  ► From ``||input:...more||``, grab ``||input:set [loud] sound threshold to [128]||`` and snap it into your **empty** ``||basic: on start||`` container.
163
131
  💡 Try to change the value of your sound threshold so that every time you clap, your lights will turn on if they are off and vice versa.
164
132
 
@@ -167,9 +135,7 @@ Your @boardname@ might detect sounds when you don't want it to. Setting a [__*so
167
135
  input.setSoundThreshold(SoundThreshold.Loud, 150)
168
136
  ```
169
137
 
170
- ## 9. Testing, round 2
171
-
172
- 👏 **YOU DID IT!** 👏
138
+ ## Testing, round 2
173
139
 
174
140
  Don't forget to test your code in the simulator!
175
141