pxt-microbit 7.0.19 → 7.0.21

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 (59) hide show
  1. package/built/block-tests.js +1 -1
  2. package/built/editor.js +24 -4
  3. package/built/target-strings.json +1 -1
  4. package/built/target.js +1 -1
  5. package/built/target.json +1 -1
  6. package/built/targetlight.json +1 -1
  7. package/docs/extensions/extension-gallery.md +12 -8
  8. package/docs/projects/analog-pin-tester.md +1 -1
  9. package/docs/projects/banana-keyboard/code.md +25 -25
  10. package/docs/projects/banana-keyboard/make.md +1 -1
  11. package/docs/projects/crashy-bird.md +12 -12
  12. package/docs/projects/fireflies.md +3 -3
  13. package/docs/projects/guitar/accelerometer.md +5 -5
  14. package/docs/projects/guitar/displaybuttons.md +7 -7
  15. package/docs/projects/guitar/lightsensor.md +4 -4
  16. package/docs/projects/guitar/pinpress.md +12 -12
  17. package/docs/projects/hack-your-headphones/code.md +19 -19
  18. package/docs/projects/hot-or-cold/beacon.md +1 -1
  19. package/docs/projects/hot-or-cold/multi-beacons.md +2 -2
  20. package/docs/projects/hot-or-cold/seekers.md +2 -2
  21. package/docs/projects/hot-or-cold.md +3 -3
  22. package/docs/projects/inchworm/code.md +5 -5
  23. package/docs/projects/inchworm/connect.md +1 -1
  24. package/docs/projects/infection.md +175 -175
  25. package/docs/projects/karel.md +37 -37
  26. package/docs/projects/light-monster/code.md +1 -1
  27. package/docs/projects/light-monster/connect.md +2 -2
  28. package/docs/projects/magic-button-trick.md +13 -13
  29. package/docs/projects/micro-coin.md +3 -3
  30. package/docs/projects/milk-carton-robot/code.md +3 -3
  31. package/docs/projects/milk-carton-robot/connect.md +2 -2
  32. package/docs/projects/milky-monster/code.md +3 -3
  33. package/docs/projects/milky-monster/connect.md +2 -2
  34. package/docs/projects/mood-radio.md +4 -4
  35. package/docs/projects/plant-watering/code.md +1 -1
  36. package/docs/projects/railway-crossing.md +5 -5
  37. package/docs/projects/rc-car/code.md +2 -2
  38. package/docs/projects/rc-car/connect.md +6 -6
  39. package/docs/projects/reaction-time/code.md +15 -15
  40. package/docs/projects/salute.md +5 -5
  41. package/docs/projects/servo-calibrator.md +3 -3
  42. package/docs/projects/soil-moisture/code.md +3 -3
  43. package/docs/projects/soil-moisture/connect.md +2 -5
  44. package/docs/projects/spy/coin-flipper.md +4 -4
  45. package/docs/projects/spy/rock-paper-scissors.md +3 -3
  46. package/docs/projects/states-of-matter/code.md +15 -15
  47. package/docs/projects/tele-potato.md +6 -6
  48. package/docs/projects/telegraph/code.md +7 -7
  49. package/docs/projects/timing-gates.md +11 -11
  50. package/docs/projects/turtle-scanner.md +1 -1
  51. package/docs/projects/turtle-spiral.md +1 -1
  52. package/docs/projects/voting-machine.md +4 -4
  53. package/docs/projects/wallet/code.md +2 -2
  54. package/docs/projects/watch/code.md +11 -11
  55. package/docs/projects/watch/digital-watch.md +37 -37
  56. package/docs/projects/watch/timer.md +9 -9
  57. package/docs/teachertool.md +178 -0
  58. package/package.json +2 -2
  59. package/targetconfig.json +2 -0
@@ -12,7 +12,7 @@ To measure this, we read the voltage on pin **P0** using ``||pins:analog read pi
12
12
  which returns a value between ``0`` (no current) and ``1023`` (maximum current). The value is graph on the screen using ``||led:plot bar graph||``.
13
13
 
14
14
  ```blocks
15
- basic.forever(() => {
15
+ basic.forever(function () {
16
16
  led.plotBarGraph(
17
17
  pins.analogReadPin(AnalogPin.P0),
18
18
  1023
@@ -33,7 +33,7 @@ This code needs to go into the ``||basic:forever||`` loop. We've also added the
33
33
 
34
34
  ```blocks
35
35
  let reading = 0
36
- basic.forever(() => {
36
+ basic.forever(function () {
37
37
  reading = pins.analogReadPin(AnalogPin.P0)
38
38
  led.plotBarGraph(
39
39
  reading,
@@ -77,7 +77,7 @@ This saves electricity and also avoids corrosion of the probes.
77
77
  ```blocks
78
78
  led.setBrightness(64)
79
79
  let reading = 0
80
- basic.forever(() => {
80
+ basic.forever(function () {
81
81
  pins.digitalWritePin(DigitalPin.P1, 1)
82
82
  basic.pause(1)
83
83
  reading = pins.analogReadPin(AnalogPin.P0)
@@ -9,16 +9,13 @@ To make it happen, we need to change the program to:
9
9
  * send the moisture level **divided by 4** as the dashboard takes values between ``0`` and ``255``.
10
10
 
11
11
  ```blocks
12
- radio.setTransmitSerialNumber(true)
13
- radio.setGroup(4)
14
12
  led.setBrightness(64)
15
13
  let reading = 0
16
- basic.forever(() => {
14
+ basic.forever(function () {
17
15
  pins.digitalWritePin(DigitalPin.P1, 1)
18
16
  basic.pause(1)
19
17
  reading = pins.analogReadPin(AnalogPin.P0)
20
18
  pins.digitalWritePin(DigitalPin.P1, 0)
21
- radio.sendNumber(reading / 4)
22
19
  led.plotBarGraph(
23
20
  reading,
24
21
  1023
@@ -26,7 +23,7 @@ basic.forever(() => {
26
23
  if (input.buttonIsPressed(Button.A)) {
27
24
  basic.showNumber(reading)
28
25
  }
29
- basic.pause(5000);
26
+ basic.pause(5000)
30
27
  })
31
28
  ```
32
29
 
@@ -14,7 +14,7 @@ Add an event to run code when ``||input:button A pressed||``. We'll put our coin
14
14
  code in here.
15
15
 
16
16
  ```spy
17
- input.onButtonPressed(Button.A, () => {
17
+ input.onButtonPressed(Button.A, function () {
18
18
  })
19
19
  ```
20
20
 
@@ -26,7 +26,7 @@ The ``||math:random boolean||`` value is used to determine a ``heads`` or ``tail
26
26
  a coin toss.
27
27
 
28
28
  ```spy
29
- input.onButtonPressed(Button.A, () => {
29
+ input.onButtonPressed(Button.A, function () {
30
30
  if (Math.randomBoolean()) {
31
31
  } else {
32
32
  }
@@ -39,7 +39,7 @@ Now, ``||basic:show icon||`` for a `skull` ``||logic:if||`` the ``||math:random
39
39
  ``tails``.
40
40
 
41
41
  ```spy
42
- input.onButtonPressed(Button.A, () => {
42
+ input.onButtonPressed(Button.A, function () {
43
43
  if (Math.randomBoolean()) {
44
44
  basic.showIcon(IconNames.Skull)
45
45
  } else {
@@ -59,7 +59,7 @@ icons before the check of the ``||math:random boolean||`` value to show that the
59
59
  coin is flipping.
60
60
 
61
61
  ```spy
62
- input.onButtonPressed(Button.A, () => {
62
+ input.onButtonPressed(Button.A, function () {
63
63
  basic.showIcon(IconNames.Diamond)
64
64
  basic.showIcon(IconNames.SmallDiamond)
65
65
  basic.showIcon(IconNames.Diamond)
@@ -13,7 +13,7 @@ Turn your micro:bit into a **Rock Paper Scissors** game that you can play with y
13
13
  We'll start our Rock Paper Scissors game when we shake 👋 our micro:bit. Add an ``||input:on shake||`` function to run code when you shake the @boardname@. Type the code below, or drag a code snippet from the ``||input:Input||`` Toolbox category.
14
14
 
15
15
  ```spy
16
- input.onGesture(Gesture.Shake, () => {
16
+ input.onGesture(Gesture.Shake, function () {
17
17
 
18
18
  })
19
19
  ```
@@ -24,7 +24,7 @@ Create a variable named "hand" - this will help us keep track of whether we have
24
24
 
25
25
  ```spy
26
26
  let hand = 0
27
- input.onGesture(Gesture.Shake, () => {
27
+ input.onGesture(Gesture.Shake, function () {
28
28
  hand = randint(1, 3)
29
29
  })
30
30
  ```
@@ -35,7 +35,7 @@ To check the value of the hand variable, type ``||logic:if hand==1||`` then use
35
35
 
36
36
  ```spy
37
37
  let hand = 0
38
- input.onGesture(Gesture.Shake, () => {
38
+ input.onGesture(Gesture.Shake, function () {
39
39
  hand = randint(1, 3)
40
40
  if (hand == 1) {
41
41
  basic.showIcon(IconNames.SmallSquare)
@@ -20,7 +20,7 @@ We want to detect when the solid state occurs. On Pin 2 Pressed, you want to rep
20
20
  ```blocks
21
21
  let temperature = 0
22
22
  let atmos_temperature = 0
23
- input.onPinPressed(TouchPin.P2, () => {
23
+ input.onPinPressed(TouchPin.P2, function () {
24
24
  atmos_temperature = 0
25
25
  basic.showString("SOLID")
26
26
  })
@@ -35,11 +35,11 @@ We want to detect when the liquid state happens. On Pin 1 Pressed, you want to r
35
35
  ```blocks
36
36
  let temperature = 0
37
37
  let atmos_temperature = 0
38
- input.onPinPressed(TouchPin.P2, () => {
38
+ input.onPinPressed(TouchPin.P2, function () {
39
39
  atmos_temperature = 0
40
40
  basic.showString("SOLID")
41
41
  })
42
- input.onPinPressed(TouchPin.P1, () => {
42
+ input.onPinPressed(TouchPin.P1, function () {
43
43
  atmos_temperature = 80
44
44
  basic.showString("LIQUID")
45
45
  })
@@ -54,15 +54,15 @@ We want to detect when matter will be a gas. On Pin 0 Pressed, you want to repre
54
54
  ```blocks
55
55
  let atmos_temperature = 0
56
56
  let temperature = 0
57
- input.onPinPressed(TouchPin.P0, () => {
57
+ input.onPinPressed(TouchPin.P0, function () {
58
58
  atmos_temperature = 250
59
59
  basic.showString("GAS")
60
60
  })
61
- input.onPinPressed(TouchPin.P2, () => {
61
+ input.onPinPressed(TouchPin.P2, function () {
62
62
  atmos_temperature = 0
63
63
  basic.showString("SOLID")
64
64
  })
65
- input.onPinPressed(TouchPin.P1, () => {
65
+ input.onPinPressed(TouchPin.P1, function () {
66
66
  atmos_temperature = 80
67
67
  basic.showString("LIQUID")
68
68
  })
@@ -79,19 +79,19 @@ We want to display a change of temperature on shake. When you shake the states o
79
79
  ```blocks
80
80
  let atmos_temperature = 0
81
81
  let temperature = 0
82
- input.onGesture(Gesture.Shake, () => {
82
+ input.onGesture(Gesture.Shake, function () {
83
83
  temperature += 50
84
84
  basic.showIcon(IconNames.Triangle)
85
85
  })
86
- input.onPinPressed(TouchPin.P0, () => {
86
+ input.onPinPressed(TouchPin.P0, function () {
87
87
  atmos_temperature = 250
88
88
  basic.showString("GAS")
89
89
  })
90
- input.onPinPressed(TouchPin.P2, () => {
90
+ input.onPinPressed(TouchPin.P2, function () {
91
91
  atmos_temperature = 0
92
92
  basic.showString("SOLID")
93
93
  })
94
- input.onPinPressed(TouchPin.P1, () => {
94
+ input.onPinPressed(TouchPin.P1, function () {
95
95
  atmos_temperature = 80
96
96
  basic.showString("LIQUID")
97
97
  })
@@ -117,11 +117,11 @@ The second condition follows this logic:
117
117
  ```blocks
118
118
  let atmos_temperature = 0
119
119
  let temperature = 0
120
- input.onGesture(Gesture.Shake, () => {
120
+ input.onGesture(Gesture.Shake, function () {
121
121
  temperature += 50
122
122
  basic.showIcon(IconNames.Triangle)
123
123
  })
124
- basic.forever(() => {
124
+ basic.forever(function () {
125
125
  if (temperature < atmos_temperature) {
126
126
  temperature += 20
127
127
  } else {
@@ -137,15 +137,15 @@ basic.forever(() => {
137
137
  basic.clearScreen()
138
138
  basic.pause(100)
139
139
  })
140
- input.onPinPressed(TouchPin.P0, () => {
140
+ input.onPinPressed(TouchPin.P0, function () {
141
141
  atmos_temperature = 250
142
142
  basic.showString("GAS")
143
143
  })
144
- input.onPinPressed(TouchPin.P2, () => {
144
+ input.onPinPressed(TouchPin.P2, function () {
145
145
  atmos_temperature = 0
146
146
  basic.showString("SOLID")
147
147
  })
148
- input.onPinPressed(TouchPin.P1, () => {
148
+ input.onPinPressed(TouchPin.P1, function () {
149
149
  atmos_temperature = 80
150
150
  basic.showString("LIQUID")
151
151
  })
@@ -55,7 +55,7 @@ To make the game less predictable, we use the ``||math:pick random||`` block to
55
55
 
56
56
  ```blocks
57
57
  let potato = 0
58
- input.onButtonPressed(Button.AB, () => {
58
+ input.onButtonPressed(Button.AB, function () {
59
59
  potato = randint(10, 20)
60
60
  })
61
61
  ```
@@ -67,7 +67,7 @@ we have the potato and we can send it. After sending it, we set the **potato** v
67
67
 
68
68
  ```blocks
69
69
  let potato = 0
70
- input.onGesture(Gesture.Shake, () => {
70
+ input.onGesture(Gesture.Shake, function () {
71
71
  if (potato > 0) {
72
72
  radio.sendNumber(potato)
73
73
  potato = -1
@@ -97,7 +97,7 @@ Making the clock tick down is done with a ``||loops:forever||`` loop.
97
97
 
98
98
  ```blocks
99
99
  let potato = 0
100
- basic.forever(() => {
100
+ basic.forever(function () {
101
101
  if (potato == 0) {
102
102
  basic.showIcon(IconNames.Skull)
103
103
  }
@@ -122,18 +122,18 @@ let potato = 0
122
122
  radio.onReceivedNumber(function (receivedNumber) {
123
123
  potato = receivedNumber
124
124
  })
125
- input.onGesture(Gesture.Shake, () => {
125
+ input.onGesture(Gesture.Shake, function () {
126
126
  if (potato > 0) {
127
127
  radio.sendNumber(potato)
128
128
  potato = -1
129
129
  }
130
130
  })
131
- input.onButtonPressed(Button.AB, () => {
131
+ input.onButtonPressed(Button.AB, function () {
132
132
  potato = randint(10, 20)
133
133
  })
134
134
  radio.setGroup(1)
135
135
  potato = -1
136
- basic.forever(() => {
136
+ basic.forever(function () {
137
137
  if (potato == 0) {
138
138
  basic.showIcon(IconNames.Skull)
139
139
  }
@@ -54,7 +54,7 @@ Let's wrap it all in a forever loop so this code is running in the background al
54
54
  Modify your code to add the blocks below. Download the code onto one of the @boardname@s, press and release button **A** a few times.
55
55
 
56
56
  ```blocks
57
- basic.forever(() => {
57
+ basic.forever(function () {
58
58
  if (input.buttonIsPressed(Button.A)) {
59
59
  pins.digitalWritePin(DigitalPin.P1, 1)
60
60
  led.plot(2, 2)
@@ -78,18 +78,18 @@ We'll turn the LED in the bottom right corner (4, 4) on to show that we received
78
78
  Make sure your code looks like this:
79
79
 
80
80
  ```blocks
81
- basic.forever(() => {
81
+ basic.forever(function () {
82
82
  if (input.buttonIsPressed(Button.A)) {
83
- pins.digitalWritePin(DigitalPin.P1, 1);
84
- led.plot(2, 2);
83
+ pins.digitalWritePin(DigitalPin.P1, 1)
84
+ led.plot(2, 2)
85
85
  } else {
86
- pins.digitalWritePin(DigitalPin.P1, 0);
86
+ pins.digitalWritePin(DigitalPin.P1, 0)
87
87
  basic.clearScreen();
88
88
  }
89
89
  if (pins.digitalReadPin(DigitalPin.P2) == 1) {
90
- led.plot(4, 4);
90
+ led.plot(4, 4)
91
91
  } else {
92
- led.unplot(4, 4);
92
+ led.unplot(4, 4)
93
93
  }
94
94
  });
95
95
  ```
@@ -48,11 +48,11 @@ basic.showLeds(`
48
48
  . . . . .
49
49
  . . . . .
50
50
  `)
51
- input.onPinPressed(TouchPin.P0, () => {})
51
+ input.onPinPressed(TouchPin.P0, function () {})
52
52
  let t = 0
53
53
  input.runningTime()
54
54
  t - 1
55
- control.eventTimestamp();
55
+ control.eventTimestamp()
56
56
  basic.showNumber(0)
57
57
  ```
58
58
 
@@ -101,7 +101,7 @@ basic.showLeds(`
101
101
  . . . . .
102
102
  . . . . .
103
103
  `)
104
- input.onPinPressed(TouchPin.P0, () => {
104
+ input.onPinPressed(TouchPin.P0, function () {
105
105
  basic.showLeds(`
106
106
  # . . . .
107
107
  # . . . .
@@ -156,7 +156,7 @@ basic.showLeds(`
156
156
  . . . . .
157
157
  . . . . .
158
158
  `)
159
- input.onPinPressed(TouchPin.P0, () => {
159
+ input.onPinPressed(TouchPin.P0, function () {
160
160
  basic.showLeds(`
161
161
  # . . . .
162
162
  # . . . .
@@ -165,7 +165,7 @@ input.onPinPressed(TouchPin.P0, () => {
165
165
  # . . . .
166
166
  `)
167
167
  })
168
- input.onPinPressed(TouchPin.P1, () => {
168
+ input.onPinPressed(TouchPin.P1, function () {
169
169
  basic.showLeds(`
170
170
  # . . . #
171
171
  # . . . #
@@ -186,8 +186,8 @@ We will record the time where each gate is tripped in variables ``t0`` and ``t1`
186
186
  We take the different between ``t1`` and ``t0`` to compute the duration between the gates.
187
187
 
188
188
  ```blocks
189
- let t0 = 0;
190
- let t1 = 0;
189
+ let t0 = 0
190
+ let t1 = 0
191
191
  basic.showLeds(`
192
192
  . . . . .
193
193
  . . . . .
@@ -195,8 +195,8 @@ basic.showLeds(`
195
195
  . . . . .
196
196
  . . . . .
197
197
  `)
198
- input.onPinPressed(TouchPin.P0, () => {
199
- t0 = control.eventTimestamp();
198
+ input.onPinPressed(TouchPin.P0, function () {
199
+ t0 = control.eventTimestamp()
200
200
  basic.showLeds(`
201
201
  # . . . .
202
202
  # . . . .
@@ -205,8 +205,8 @@ input.onPinPressed(TouchPin.P0, () => {
205
205
  # . . . .
206
206
  `)
207
207
  })
208
- input.onPinPressed(TouchPin.P1, () => {
209
- t1 = control.eventTimestamp();
208
+ input.onPinPressed(TouchPin.P1, function () {
209
+ t1 = control.eventTimestamp()
210
210
  basic.showLeds(`
211
211
  # . . . #
212
212
  # . . . #
@@ -18,7 +18,7 @@ The turtle scans the display over and over again.
18
18
  turtle.setPosition(0, 0)
19
19
  turtle.turnRight()
20
20
  turtle.setSpeed(20)
21
- basic.forever(() => {
21
+ basic.forever(function () {
22
22
  turtle.forward(4)
23
23
  turtle.turnRight()
24
24
  turtle.forward(1)
@@ -17,7 +17,7 @@ A turtle that spirals into the center of the display and back out again.
17
17
  ```blocks
18
18
  turtle.setPosition(0, 0)
19
19
  turtle.turnRight()
20
- basic.forever(() => {
20
+ basic.forever(function () {
21
21
  for (let index = 0; index <= 4; index++) {
22
22
  turtle.forward(4 - index)
23
23
  turtle.turnRight()
@@ -21,7 +21,7 @@ Assuming button ``A`` is for a NO vote and ``B`` is for YES, the voter program w
21
21
  When button ``A`` is pressed, a number ``0`` is sent via radio and the ``X`` symbol is shown on the screen.
22
22
 
23
23
  ```block
24
- input.onButtonPressed(Button.A, () => {
24
+ input.onButtonPressed(Button.A, function () {
25
25
  radio.sendNumber(0)
26
26
  basic.showIcon(IconNames.No)
27
27
  })
@@ -32,7 +32,7 @@ input.onButtonPressed(Button.A, () => {
32
32
  When button ``B`` is pressed, a number ``255`` is sent via radio and the ``Y`` symbol is shown on the screen.
33
33
 
34
34
  ```block
35
- input.onButtonPressed(Button.B, () => {
35
+ input.onButtonPressed(Button.B, function () {
36
36
  radio.sendNumber(255)
37
37
  basic.showIcon(IconNames.Yes)
38
38
  })
@@ -56,11 +56,11 @@ radio.setGroup(4)
56
56
  Putting all the parts together, here's the complete voter program:
57
57
 
58
58
  ```blocks
59
- input.onButtonPressed(Button.A, () => {
59
+ input.onButtonPressed(Button.A, function () {
60
60
  radio.sendNumber(0)
61
61
  basic.showIcon(IconNames.No)
62
62
  })
63
- input.onButtonPressed(Button.B, () => {
63
+ input.onButtonPressed(Button.B, function () {
64
64
  radio.sendNumber(255)
65
65
  basic.showIcon(IconNames.Yes)
66
66
  })
@@ -5,7 +5,7 @@
5
5
  Let's start by using a combination of [forever](/reference/basic/forever) and [show leds](/reference/basic/show-leds) to create animation:
6
6
 
7
7
  ```blocks
8
- basic.forever(() => {
8
+ basic.forever(function () {
9
9
  basic.showLeds(`
10
10
  # # . # #
11
11
  # # . # #
@@ -34,7 +34,7 @@ How do we know that the wallet is in the pocket? It is really dark in there... W
34
34
  Using an [if statement](/blocks/logic/if), we can test if the level of light is sufficient to turn on the screen. Otherwise, we turn off the screen for a few second to save energy.
35
35
 
36
36
  ```blocks
37
- basic.forever(() => {
37
+ basic.forever(function () {
38
38
  if (input.lightLevel() > 16) {
39
39
  basic.showLeds(`
40
40
  # # . # #
@@ -17,9 +17,9 @@ We need a variable to keep track of how many motions you make.
17
17
  3. Let's show that there are no motions counted yet. Get a ``||basic:show number||`` from **Basic** and put it after the variable. Now, change the `0` to the `motions` variable from the **Variables** category in the toolbox.
18
18
 
19
19
  ```blocks
20
- let motions = 0;
21
- motions = 0;
22
- basic.showNumber(motions);
20
+ let motions = 0
21
+ motions = 0
22
+ basic.showNumber(motions)
23
23
  ```
24
24
 
25
25
  ## Count your movements
@@ -31,10 +31,10 @@ Ok, now we'll count and show all of your movements.
31
31
  3. Grab another ``||basic:show number||`` and put it at the bottom of the ``||input:on shake||``. Find `motions` again back over in **Variables** and replace the `0` with it.
32
32
 
33
33
  ```blocks
34
- let motions = 0;
35
- input.onGesture(Gesture.Shake, () => {
36
- motions += 1;
37
- basic.showNumber(motions);
34
+ let motions = 0
35
+ input.onGesture(Gesture.Shake, function () {
36
+ motions += 1
37
+ basic.showNumber(motions)
38
38
  })
39
39
  ```
40
40
 
@@ -46,10 +46,10 @@ If we want to start over from zero, then we need to have a way to reset the moti
46
46
  2. Grab another ``||basic:show number||`` and change the `0` to the a `motions` variable.
47
47
 
48
48
  ```blocks
49
- let motions = 0;
50
- input.onButtonPressed(Button.A, () => {
51
- motions = 0;
52
- basic.showNumber(motions);
49
+ let motions = 0
50
+ input.onButtonPressed(Button.A, function () {
51
+ motions = 0
52
+ basic.showNumber(motions)
53
53
  })
54
54
  ```
55
55
 
@@ -39,9 +39,9 @@ So, let's try showing the time on the display. We aren't keeping time yet but we
39
39
  let time = ""
40
40
  let minutes = 0
41
41
  let hours = 0
42
- input.onGesture(Gesture.Shake, () => {
43
- time = hours + (":" + minutes);
44
- basic.showString(time);
42
+ input.onGesture(Gesture.Shake, function () {
43
+ time = hours + (":" + minutes)
44
+ basic.showString(time)
45
45
  })
46
46
  ```
47
47
  ## Set the time with buttons
@@ -58,12 +58,12 @@ Let's make a way to set the hours for the watch.
58
58
  6. In the ``||logic:else||`` section, put a ``||variables:set to||`` there. Select the `hours` variable name from the dropdown and leave the `0`.
59
59
 
60
60
  ```blocks
61
- let hours = 0;
62
- input.onButtonPressed(Button.A, () => {
61
+ let hours = 0
62
+ input.onButtonPressed(Button.A, function () {
63
63
  if (hours < 23) {
64
- hours += 1;
64
+ hours += 1
65
65
  } else {
66
- hours = 0;
66
+ hours = 0
67
67
  }
68
68
  })
69
69
  ```
@@ -76,12 +76,12 @@ Setting minutes is almost the same as setting hours but with just a few changes.
76
76
  3. Change every variable name from `hours` to `minutes`. Change the `23` in the ``||logic:if||`` condition to ``59``. This is the limit of minutes we count.
77
77
 
78
78
  ```blocks
79
- let minutes = 0;
80
- input.onButtonPressed(Button.B, () => {
79
+ let minutes = 0
80
+ input.onButtonPressed(Button.B, function () {
81
81
  if (minutes < 59) {
82
- minutes += 1;
82
+ minutes += 1
83
83
  } else {
84
- minutes = 0;
84
+ minutes = 0
85
85
  }
86
86
  })
87
87
  ```
@@ -95,9 +95,9 @@ Time is shown in either 24 hour or 12 hour format. We'll use one more button to
95
95
  3. Pick up a `ampm` from **Variables** and connect it on the right of the ``||logic:not||``. This switches our 24 hour format to 12 hour and back.
96
96
 
97
97
  ```blocks
98
- let ampm = false;
99
- input.onButtonPressed(Button.AB, () => {
100
- ampm = !(ampm);
98
+ let ampm = false
99
+ input.onButtonPressed(Button.AB, function () {
100
+ ampm = !(ampm)
101
101
  })
102
102
  ```
103
103
 
@@ -114,12 +114,12 @@ A watch really has three parts: the display, settings, and timer. We need a way
114
114
 
115
115
  ```blocks
116
116
  let minutes = 0;
117
- basic.forever(() => {
117
+ basic.forever(function () {
118
118
  basic.pause(60000)
119
119
  if (minutes < 59) {
120
- minutes += 1;
120
+ minutes += 1
121
121
  } else {
122
- minutes = 0;
122
+ minutes = 0
123
123
  }
124
124
  })
125
125
  ```
@@ -134,7 +134,7 @@ basic.forever(() => {
134
134
  ```blocks
135
135
  let minutes = 0
136
136
  let hours = 0
137
- basic.forever(() => {
137
+ basic.forever(function () {
138
138
  basic.pause(60000)
139
139
  if (minutes < 59) {
140
140
  minutes += 1
@@ -167,7 +167,7 @@ First, we have to code an adjustment for the hours number when we're using the 1
167
167
  let hours = 0;
168
168
  let adjust = 0;
169
169
  let ampm = false;
170
- input.onGesture(Gesture.Shake, () => {
170
+ input.onGesture(Gesture.Shake, function () {
171
171
  adjust = hours;
172
172
  if (ampm) {
173
173
  if (hours > 12) {
@@ -194,24 +194,24 @@ Now, we have to join up the hours and minutes to make text that will display on
194
194
  7. In the fourth copy, change the first `""` in the ``||text:join||`` to the variable `time`. Change the second string in the ``||text:join||`` to a ``minutes``.
195
195
 
196
196
  ```blocks
197
- let minutes = 0;
198
- let hours = 0;
199
- let adjust = 0;
200
- let time = "";
201
- let ampm = false;
202
- input.onGesture(Gesture.Shake, () => {
203
- adjust = hours;
197
+ let minutes = 0
198
+ let hours = 0
199
+ let adjust = 0
200
+ let time = ""
201
+ let ampm = false
202
+ input.onGesture(Gesture.Shake, function () {
203
+ adjust = hours
204
204
  if (ampm) {
205
205
  if (hours > 12) {
206
- adjust = hours - 12;
206
+ adjust = hours - 12
207
207
  } else {
208
208
  if (hours == 0) {
209
- adjust = 12;
209
+ adjust = 12
210
210
  }
211
211
  }
212
212
  }
213
- time = "" + adjust;
214
- time = time + ":";
213
+ time = "" + adjust
214
+ time = time + ":"
215
215
  if (minutes < 10) {
216
216
  time = time + "0"
217
217
  }
@@ -230,12 +230,12 @@ Ok, we're getting close to finishing now. Here we need to add the 'AM' or 'PM' i
230
230
  5. Finally, at the very bottom of ``||input:on shake||``, go get a ``||basic:show string||`` from **Basic** and put it there. Change the string `"Hello!"` to the `time` variable.
231
231
 
232
232
  ```blocks
233
- let minutes = 0;
234
- let hours = 0;
235
- let adjust = 0;
236
- let time = "";
237
- let ampm = false;
238
- input.onGesture(Gesture.Shake, () => {
233
+ let minutes = 0
234
+ let hours = 0
235
+ let adjust = 0
236
+ let time = ""
237
+ let ampm = false
238
+ input.onGesture(Gesture.Shake, function () {
239
239
  adjust = hours;
240
240
  if (ampm) {
241
241
  if (hours > 12) {
@@ -246,7 +246,7 @@ input.onGesture(Gesture.Shake, () => {
246
246
  }
247
247
  }
248
248
  }
249
- time = "" + adjust;
249
+ time = "" + adjust
250
250
  time = time + ":"
251
251
  if (minutes < 10)
252
252
  {