pxt-microbit 6.1.2 → 6.1.4
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.
- package/built/hexcache/{a205d05d10c4848e8a9454ddb6b085235213690f446c18ac8eb610d69c8c0d98.hex → 02e118276d7ad61fd1e7913a87f10d8ffee34a65b883e7b8efce291712f45092.hex} +10499 -10480
- package/built/hexcache/{1a29827806d7ca2a8e55b95c99194503f7fdfaa45a3ebfcc25cda8e5c1e51824.hex → 56661ceac4d8678e416df6f0cb117457b277232c45f0a578a9298d26f8eaba35.hex} +9914 -9895
- package/built/hexcache/62b44871df9fdf64381631c44888c831f0e73d4a7a6221dc1b91aea7bd9aa76a.hex +14523 -0
- package/built/hexcache/f4b5733caac6970862b68d159aad886755259b131a794060ce8075730c534b64.hex +13996 -0
- package/built/sim-strings.json +1 -1
- package/built/sim.d.ts +10 -0
- package/built/sim.js +133 -23
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.json +1 -1
- package/built/web/react-common-authcode.css +1 -1
- package/built/web/react-common-multiplayer.css +1 -1
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-authcode.css +1 -1
- package/built/web/rtlreact-common-multiplayer.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +3 -3
- package/built/web/semantic.css +3 -3
- package/docs/extensions.md +16 -0
- package/docs/projects/7-seconds.md +8 -8
- package/docs/projects/carnival/button-points.md +118 -0
- package/docs/projects/carnival/circuit-win.md +107 -0
- package/docs/projects/carnival/shake-lose.md +97 -0
- package/docs/projects/coin-flipper.md +8 -8
- package/docs/projects/compass.md +12 -17
- package/docs/projects/dice.md +15 -8
- package/docs/projects/flashing-heart.md +4 -4
- package/docs/projects/heads-guess.md +10 -10
- package/docs/projects/hot-potato.md +8 -8
- package/docs/projects/love-meter.md +12 -6
- package/docs/projects/magic-button-trick.md +2 -4
- package/docs/projects/multi-dice.md +7 -7
- package/docs/projects/name-tag.md +5 -5
- package/docs/projects/rock-paper-scissors-v2.md +13 -13
- package/docs/projects/rock-paper-scissors.md +12 -12
- package/docs/projects/smiley-buttons.md +7 -7
- package/docs/projects/v2-blow-away.md +17 -13
- package/docs/projects/v2-cat-napping.md +18 -14
- package/docs/projects/v2-clap-lights.md +19 -10
- package/docs/projects/v2-countdown.md +16 -8
- package/docs/projects/v2-morse-chat.md +13 -13
- package/docs/projects/v2-pet-hamster.md +26 -13
- package/docs/reference/input/compass-heading.md +9 -5
- package/docs/reference/input/magnetic-force.md +16 -8
- package/docs/static/orglogowide.png +0 -0
- package/docs/translate.md +4 -4
- package/package.json +3 -3
- package/pxtarget.json +12 -18
- package/sim/public/simulator.html +45 -0
- package/targetconfig.json +6 -2
- package/built/hexcache/215f0a9c22dcecda497365fd42b85e341eda40aa40d2d69d427265c77cc5f004.hex +0 -14333
- package/built/hexcache/704323c8559a596aec81e104e6d4bb8ae10bafd9dec77489fbb082158b23a4e4.hex +0 -14853
- package/sim/public/parts/.gitignore +0 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Heads Guess!
|
|
2
2
|
|
|
3
|
-
## Introduction @unplugged
|
|
3
|
+
## {Introduction @unplugged}
|
|
4
4
|
|
|
5
5
|
This is a simple remake of the famous **Heads Up!** game. The player holds the @boardname@ on the forehead and has 30 seconds to guess words displayed on the screen.
|
|
6
6
|
If the guess is correct, the player tilts the @boardname@ forward; to pass, the player tilts it backwards.
|
|
7
7
|
|
|
8
|
-
## Step 1
|
|
8
|
+
## {Step 1}
|
|
9
9
|
|
|
10
10
|
Put in code to ``||game:start a countdown||`` of 30 seconds.
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ Put in code to ``||game:start a countdown||`` of 30 seconds.
|
|
|
13
13
|
game.startCountdown(30000)
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
## Step 2
|
|
16
|
+
## {Step 2}
|
|
17
17
|
|
|
18
18
|
Create a ``||arrays:text list||`` of words to guess. You will find **Arrays** under **Advanced**.
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ text_list = ["PUPPY", "CLOCK", "NIGHT"]
|
|
|
23
23
|
game.startCountdown(30000)
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
## Step 3
|
|
26
|
+
## {Step 3}
|
|
27
27
|
|
|
28
28
|
Add an event to run code when the @boardname@ ``||input:logo||`` is pointing ``||input:up||``.
|
|
29
29
|
This is the gesture to get a new word.
|
|
@@ -33,7 +33,7 @@ input.onGesture(Gesture.LogoUp, function () {
|
|
|
33
33
|
})
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
## Step 4
|
|
36
|
+
## {Step 4}
|
|
37
37
|
|
|
38
38
|
The items in ``||arrays:text list||`` are numbered ``0`` to ``length - 1``.
|
|
39
39
|
Add code to pick a ``||math:random||`` ``||variables:index||``.
|
|
@@ -47,7 +47,7 @@ input.onGesture(Gesture.LogoUp, function () {
|
|
|
47
47
|
})
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
## Step 5
|
|
50
|
+
## {Step 5}
|
|
51
51
|
|
|
52
52
|
Add code to ``||basic:show||`` the value of the item stored at ``||variables:index||`` in ``||arrays:text list||``.
|
|
53
53
|
|
|
@@ -61,7 +61,7 @@ input.onGesture(Gesture.LogoUp, function () {
|
|
|
61
61
|
})
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
## Step 6
|
|
64
|
+
## {Step 6}
|
|
65
65
|
|
|
66
66
|
Use an event to run code when the @boardname@ ``||input:screen||`` is pointing ``||input:down||``.
|
|
67
67
|
This is the gesture for a correct guess.
|
|
@@ -71,7 +71,7 @@ input.onGesture(Gesture.ScreenDown, function () {
|
|
|
71
71
|
})
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
## Step 7
|
|
74
|
+
## {Step 7}
|
|
75
75
|
|
|
76
76
|
Put in code to add points to the ``||game:score||``.
|
|
77
77
|
|
|
@@ -82,7 +82,7 @@ input.onGesture(Gesture.ScreenDown, function () {
|
|
|
82
82
|
})
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
## Step 8
|
|
85
|
+
## {Step 8}
|
|
86
86
|
|
|
87
87
|
Add anonther event to run code when the @boardname@ ``||input:screen||`` is pointing ``||input:up||``.
|
|
88
88
|
This is the gesture for a pass.
|
|
@@ -92,7 +92,7 @@ input.onGesture(Gesture.ScreenUp, function () {
|
|
|
92
92
|
})
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
## Step 9
|
|
95
|
+
## {Step 9}
|
|
96
96
|
|
|
97
97
|
For the pass gesture, add code to remove a ``||game:life||`` from the player.
|
|
98
98
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Hot Potato
|
|
2
2
|
|
|
3
|
-
## Introduction @unplugged
|
|
3
|
+
## {Introduction @unplugged}
|
|
4
4
|
|
|
5
5
|
In this game, you will start a timer with a random countdown of a number of seconds. When the timer is off, the game is over and whoever is holding the potato has lost!
|
|
6
6
|
Watch the tutorial on the [MakeCode YouTube channel](https://youtu.be/xLEy1B_gWKY).
|
|
7
7
|
|
|
8
|
-
## Step 1
|
|
8
|
+
## {Step 1}
|
|
9
9
|
|
|
10
10
|
Add an event to run code when ``||input:button A is pressed||``.
|
|
11
11
|
|
|
@@ -14,7 +14,7 @@ input.onButtonPressed(Button.A, function () {
|
|
|
14
14
|
})
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
## Step 2
|
|
17
|
+
## {Step 2}
|
|
18
18
|
|
|
19
19
|
Make a ``||variables:timer||`` variable and ``||variables:set||`` it to
|
|
20
20
|
a ``||math:random value||`` between ``5`` and ``15``.
|
|
@@ -29,7 +29,7 @@ input.onButtonPressed(Button.A, function () {
|
|
|
29
29
|
})
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
## Step 3
|
|
32
|
+
## {Step 3}
|
|
33
33
|
|
|
34
34
|
Add code to ``||basic:show||`` that the game started.
|
|
35
35
|
|
|
@@ -42,7 +42,7 @@ input.onButtonPressed(Button.A, function () {
|
|
|
42
42
|
})
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
## Step 4
|
|
45
|
+
## {Step 4}
|
|
46
46
|
|
|
47
47
|
Put in a loop to repeat code ``||loops:while||`` ``||variables:timer||`` ``||logic:is positive||``. When `timer` is negative, the game is over.
|
|
48
48
|
|
|
@@ -58,7 +58,7 @@ input.onButtonPressed(Button.A, function () {
|
|
|
58
58
|
})
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
## Step 5
|
|
61
|
+
## {Step 5}
|
|
62
62
|
|
|
63
63
|
Inside the ``||loops:while||`` loop, add code to ``||variables:decrease||`` the timer ``||loops:every second||``.
|
|
64
64
|
|
|
@@ -76,7 +76,7 @@ input.onButtonPressed(Button.A, function () {
|
|
|
76
76
|
})
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
## Step 6
|
|
79
|
+
## {Step 6}
|
|
80
80
|
|
|
81
81
|
**After** the ``||loops:while||`` loop is done, add code to ``||basic:show||`` that the game is over.
|
|
82
82
|
|
|
@@ -94,7 +94,7 @@ input.onButtonPressed(Button.A, function () {
|
|
|
94
94
|
})
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
## Step 7
|
|
97
|
+
## {Step 7}
|
|
98
98
|
|
|
99
99
|
`|Download|` your code to your @boardname@, tape it to a potato and play the game with your friends!
|
|
100
100
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Love Meter
|
|
2
2
|
|
|
3
|
-
## Introduction @unplugged
|
|
3
|
+
## {Introduction @unplugged}
|
|
4
4
|
|
|
5
5
|
Make a love meter, how sweet! The @boardname@ is feeling the love, then sometimes not so much!
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
## Step 1
|
|
9
|
+
## {Step 1}
|
|
10
10
|
|
|
11
11
|
Let's build a **LOVE METER** machine. We'll use an ``||input:on pin pressed||`` block to run code when pin **0** is pressed. Use ``P0`` from the list of pin inputs.
|
|
12
12
|
|
|
@@ -15,34 +15,40 @@ input.onPinPressed(TouchPin.P0, function() {
|
|
|
15
15
|
})
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
## Step 2
|
|
18
|
+
## {Step 2}
|
|
19
19
|
|
|
20
20
|
Using ``||basic:show number||`` and ``||Math:pick random||`` blocks, show a random number from `0` to `100` when pin **0** is pressed.
|
|
21
21
|
|
|
22
22
|
```blocks
|
|
23
23
|
input.onPinPressed(TouchPin.P0, function() {
|
|
24
|
+
//@highlight
|
|
24
25
|
basic.showNumber(randint(0, 100))
|
|
25
26
|
})
|
|
26
27
|
```
|
|
27
|
-
## Step 3
|
|
28
|
+
## {Step 3}
|
|
28
29
|
|
|
29
30
|
Click on pin **0** in the simulator and see which number is chosen.
|
|
30
31
|
|
|
31
|
-
## Step 4
|
|
32
|
+
## {Step 4}
|
|
32
33
|
|
|
33
34
|
Show ``"LOVE METER"`` on the screen when the @boardname@ starts.
|
|
34
35
|
|
|
35
36
|
```blocks
|
|
37
|
+
//@highlight
|
|
36
38
|
basic.showString("LOVE METER")
|
|
37
39
|
input.onPinPressed(TouchPin.P0, function() {
|
|
38
40
|
basic.showNumber(randint(0, 100))
|
|
39
41
|
});
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
## Step 5
|
|
44
|
+
## {Step 5}
|
|
43
45
|
|
|
44
46
|
Click ``|Download|`` to transfer your code in your @boardname@. Hold the **GND** pin with one hand and press pin **0** with the other hand to trigger this code.
|
|
45
47
|
|
|
48
|
+
```validation.global
|
|
49
|
+
# BlocksExistValidator
|
|
50
|
+
```
|
|
51
|
+
|
|
46
52
|
```template
|
|
47
53
|
input.onPinPressed(TouchPin.P0, function() {})
|
|
48
54
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## ~avatar avatar
|
|
4
4
|
|
|
5
|
-
Build a magic trick that uses the @boardname@'s
|
|
5
|
+
Build a magic trick that uses the @boardname@'s magnetometer to detect a nearby magnet!
|
|
6
6
|
|
|
7
7
|
## ~
|
|
8
8
|
|
|
@@ -33,7 +33,7 @@ input.onButtonPressed(Button.B, () => {
|
|
|
33
33
|
|
|
34
34
|
## Step 2: Measuring magnetic force
|
|
35
35
|
|
|
36
|
-
We will use the @boardname@'s
|
|
36
|
+
We will use the @boardname@'s magnetometer to detect the magnet. We will use it to check if our magnet is next to the @boardname@ by using the ``||input:magnetic force||`` block found in the **Input** menu's **... More** section. Since we only want to measure the strength we change the drop down to select `strength`:
|
|
37
37
|
|
|
38
38
|
```block
|
|
39
39
|
let force = input.magneticForce(Dimension.Strength)
|
|
@@ -96,8 +96,6 @@ input.onButtonPressed(Button.B, () => {
|
|
|
96
96
|
|
|
97
97
|
Now you just need to program your own @boardname@ and practice the trick a few times before performing for your friends. Try asking your friends to click the buttons after you have switched the labels and the trick won't work for them because they don't have a hidden magnet in their hand!
|
|
98
98
|
|
|
99
|
-
Remember, that as we are using @boardname@'s compass, it will need to be [calibrated](https://support.microbit.org/support/solutions/articles/19000008874-calibrating-the-micro-bit-compass-what-does-it-mean-when-the-micro-bit-says-draw-a-circle-or-tilt) each time we flash the program or run it for the first time.
|
|
100
|
-
|
|
101
99
|
## About the authors
|
|
102
100
|
|
|
103
101
|
This project was contributed by Brian and Jasmine Norman, aka [@MicroMonstersUK](https://twitter.com/MicroMonstersUK). You can checkout their [MicroMonsters](https://www.youtube.com/channel/UCK2DviDexh_Er2QYZerZyZQ) tutorials channel on YouTube for more projects.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Multi Dice
|
|
2
2
|
|
|
3
|
-
## Introduction @unplugged
|
|
3
|
+
## {Introduction @unplugged}
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ Build a multi-player dice game using the **radio**. The **radio** blocks let you
|
|
|
8
8
|
|
|
9
9
|
In this game, you shake to "throw the dice" and send the result to the other @boardname@. If you receive a result of a dice throw equal or greater than yours, you lose.
|
|
10
10
|
|
|
11
|
-
## Dice game
|
|
11
|
+
## {Dice game}
|
|
12
12
|
|
|
13
13
|
Let's start by rebuilding the **dice** game. If you are unsure about the details, try the **dice** tutorial again.
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
18
18
|
})
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
## Dice variable
|
|
21
|
+
## {Dice variable}
|
|
22
22
|
|
|
23
23
|
We need to store the result of the dice cast in a variable. A **variable** is like a place in the memory of the @boardname@ where you save information, like numbers.
|
|
24
24
|
|
|
@@ -34,7 +34,7 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
34
34
|
})
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
## Send the dice
|
|
37
|
+
## {Send the dice}
|
|
38
38
|
|
|
39
39
|
Put in a ``||radio:send number||`` and a ``||variables:dice||`` to send the value stored in the ``||variables:dice||`` variable via radio. Make sure to add a ``||radio:set group||`` to ``||basic:on start||`` with the group number set to the group you want to use.
|
|
40
40
|
|
|
@@ -48,7 +48,7 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
48
48
|
})
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
## Receive the dice
|
|
51
|
+
## {Receive the dice}
|
|
52
52
|
|
|
53
53
|
Go get an ``||radio:on received number||`` event block. This event runs when a radio message from another @boardname@ arrives. The ``||variables:receivedNumber||`` value is the value of the dice in this game.
|
|
54
54
|
|
|
@@ -57,7 +57,7 @@ radio.onReceivedNumber(function (receivedNumber) {
|
|
|
57
57
|
})
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
## Check your cast
|
|
60
|
+
## {Check your cast}
|
|
61
61
|
|
|
62
62
|
Add a ``||logic:if||`` block to test if ``||variables:receivedNumber||`` is greater or equal to ``||variables:dice||``.
|
|
63
63
|
If is, you lost so display a sad face on the screen.
|
|
@@ -71,7 +71,7 @@ radio.onReceivedNumber(function (receivedNumber) {
|
|
|
71
71
|
})
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
## Test it!
|
|
74
|
+
## {Test it!}
|
|
75
75
|
|
|
76
76
|
Try pressing **SHAKE** in the simulator and see that a second @boardname@ appears. You can play the game on both virtual boards.
|
|
77
77
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Name Tag
|
|
2
2
|
|
|
3
|
-
## Introduction @unplugged
|
|
3
|
+
## {Introduction @unplugged}
|
|
4
4
|
|
|
5
5
|
Tell everyone who you are. Show you name on the LEDs.
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
## Step 1
|
|
9
|
+
## {Step 1}
|
|
10
10
|
|
|
11
11
|
Place the ``||basic:show string||`` block in the ``||basic:forever||`` block to repeat it. Change the text to your name.
|
|
12
12
|
|
|
@@ -16,11 +16,11 @@ basic.forever(function() {
|
|
|
16
16
|
})
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## Step 2
|
|
19
|
+
## {Step 2}
|
|
20
20
|
|
|
21
21
|
Look at the simulator and make sure it shows your name on the screen.
|
|
22
22
|
|
|
23
|
-
## Step 3
|
|
23
|
+
## {Step 3}
|
|
24
24
|
|
|
25
25
|
Place more ``||basic:show string||`` blocks to create your own story.
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ basic.forever(function() {
|
|
|
31
31
|
})
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
## Step 4
|
|
34
|
+
## {Step 4}
|
|
35
35
|
|
|
36
36
|
If you have a @boardname@ connected, click ``|Download|`` to transfer your code and watch your name scroll!
|
|
37
37
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Rock Paper Scissors V2
|
|
2
2
|
|
|
3
|
-
## Introduction @unplugged
|
|
3
|
+
## {Introduction @unplugged}
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
Build a "Rock Paper Scissors" game with ADDED BONUS SOUNDS using the **micro:bit V2** buzzer!
|
|
8
8
|
|
|
9
|
-
## Step 1 @fullscreen
|
|
9
|
+
## {Step 1 @fullscreen}
|
|
10
10
|
|
|
11
11
|
Use the ``||input:on shake||`` block in the Workspace to run code when you shake the @boardname@.
|
|
12
12
|
|
|
@@ -16,13 +16,13 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
16
16
|
})
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## Step 2 @fullscreen
|
|
19
|
+
## {Step 2 @fullscreen}
|
|
20
20
|
|
|
21
21
|
Make a new variable called ``hand`` and place the ``||variables:set hand to||`` block in the shake event.
|
|
22
22
|
|
|
23
23
|

|
|
24
24
|
|
|
25
|
-
## Step 3 @fullscreen
|
|
25
|
+
## {Step 3 @fullscreen}
|
|
26
26
|
|
|
27
27
|
Add a ``||math:pick random||`` block to pick a random number from `1` to `3` and store it in the variable named ``hand``.
|
|
28
28
|
|
|
@@ -35,7 +35,7 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
35
35
|
|
|
36
36
|
In a later step, each of the possible numbers (`1`, `2`, or `3`) is matched to its own picture. The picture is shown on the LEDs when its matching number is picked.
|
|
37
37
|
|
|
38
|
-
## Step 4 @fullscreen
|
|
38
|
+
## {Step 4 @fullscreen}
|
|
39
39
|
|
|
40
40
|
Place an ``||logic:if||`` block under the ``||math:pick random||`` and check whether ``hand`` is equal to ``1``. Add a ``||basic:show leds||`` block that shows a picture of a piece of paper. The number `1` is the value for paper.
|
|
41
41
|
|
|
@@ -57,7 +57,7 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
57
57
|
})
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
## Step 5 @fullscreen
|
|
60
|
+
## {Step 5 @fullscreen}
|
|
61
61
|
|
|
62
62
|
Place a ``||music:play sound||`` block under ``||basic:show leds||`` and edit it to make it sound like paper.
|
|
63
63
|
|
|
@@ -78,14 +78,14 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
78
78
|
})
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
## Step 6 @fullscreen
|
|
81
|
+
## {Step 6 @fullscreen}
|
|
82
82
|
|
|
83
83
|
Click on the **SHAKE** button in the simulator. If you try enough times, you should see a picture of paper on the screen.
|
|
84
84
|
|
|
85
85
|

|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
## Step 7 @fullscreen
|
|
88
|
+
## {Step 7 @fullscreen}
|
|
89
89
|
|
|
90
90
|
Click the **(+)** button to add an ``||logic:else||`` section.
|
|
91
91
|
|
|
@@ -110,7 +110,7 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
110
110
|
})
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
## Step 8 @fullscreen
|
|
113
|
+
## {Step 8 @fullscreen}
|
|
114
114
|
|
|
115
115
|
Add both a ``||basic:show leds||`` block and a ``||music:play sound||`` block inside the ``||logic:else||``. Make a picture for **scissors** using LEDs and create a scissors sound.
|
|
116
116
|
|
|
@@ -140,13 +140,13 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
140
140
|
})
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
## Step 9 @fullscreen
|
|
143
|
+
## {Step 9 @fullscreen}
|
|
144
144
|
|
|
145
145
|
Click the **(+)** button again to add an ``||logic:else if||`` section. Now, add a conditional block for ``||logic:hand = 2||`` to the empty slot in the ``||logic:else if||``. Since ``hand`` can only be `1`, `2`, or `3`, your code is now covering all possible cases!
|
|
146
146
|
|
|
147
147
|

|
|
148
148
|
|
|
149
|
-
## Step 10 @fullscreen
|
|
149
|
+
## {Step 10 @fullscreen}
|
|
150
150
|
|
|
151
151
|
Get one more ``||basic:show leds||`` block and ``||music:play sound||`` block and put them inside the ``||logic:else if||``. Make a picture of a rock in the LEDs and create a rock-like sound.
|
|
152
152
|
|
|
@@ -185,13 +185,13 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
185
185
|
})
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
## Step 11 @fullscreen
|
|
188
|
+
## {Step 11 @fullscreen}
|
|
189
189
|
|
|
190
190
|
Click on the **SHAKE** button in the simulator and check to see that each image is showing up.
|
|
191
191
|
|
|
192
192
|

|
|
193
193
|
|
|
194
|
-
## Step 12 @fullscreen
|
|
194
|
+
## {Step 12 @fullscreen}
|
|
195
195
|
|
|
196
196
|
If you have a @boardname@ V2, click on ``|Download|`` and follow the instructions to get the code
|
|
197
197
|
onto your @boardname@.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Rock Paper Scissors
|
|
2
2
|
|
|
3
|
-
## Introduction @unplugged
|
|
3
|
+
## {Introduction @unplugged}
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
Use the accelerometer and the screen to build a **Rock Paper Scissors** game that you can play with your friends!
|
|
8
8
|
|
|
9
|
-
## Step 1 @fullscreen
|
|
9
|
+
## {Step 1 @fullscreen}
|
|
10
10
|
|
|
11
11
|
Let's use a ``||input:on shake||`` block to run code when you shake the @boardname@.
|
|
12
12
|
|
|
@@ -16,13 +16,13 @@ input.onGesture(Gesture.Shake, function() {
|
|
|
16
16
|
})
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## Step 2 @fullscreen
|
|
19
|
+
## {Step 2 @fullscreen}
|
|
20
20
|
|
|
21
21
|
Add a ``hand`` variable and place the ``||variables:set hand to||`` block in the shake event.
|
|
22
22
|
|
|
23
23
|

|
|
24
24
|
|
|
25
|
-
## Step 3 @fullscreen
|
|
25
|
+
## {Step 3 @fullscreen}
|
|
26
26
|
|
|
27
27
|
Add a ``||math:pick random||`` block to pick a random number from `1` to `3` and store it in the variable named ``hand``.
|
|
28
28
|
|
|
@@ -35,7 +35,7 @@ input.onGesture(Gesture.Shake, function() {
|
|
|
35
35
|
|
|
36
36
|
In a later step, each of the possible numbers (`1`, `2`, or `3`) is matched to its own picture. The picture is shown on the LEDs when its matching number is picked.
|
|
37
37
|
|
|
38
|
-
## Step 4 @fullscreen
|
|
38
|
+
## {Step 4 @fullscreen}
|
|
39
39
|
|
|
40
40
|
Place an ``||logic:if||`` block under the ``||math:pick random||`` and check whether ``hand`` is equal to ``1``. Add a ``||basic:show leds||`` block that shows a picture of a piece of paper. The number `1` will mean paper.
|
|
41
41
|
|
|
@@ -57,13 +57,13 @@ input.onGesture(Gesture.Shake, function() {
|
|
|
57
57
|
})
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
## Step 5 @fullscreen
|
|
60
|
+
## {Step 5 @fullscreen}
|
|
61
61
|
|
|
62
62
|
Click on the **SHAKE** button in the simulator. If you try enough times, you should see a picture of paper on the screen.
|
|
63
63
|
|
|
64
64
|

|
|
65
65
|
|
|
66
|
-
## Step 6 @fullscreen
|
|
66
|
+
## {Step 6 @fullscreen}
|
|
67
67
|
|
|
68
68
|
Click the **(+)** button to add an ``||logic:else||`` section.
|
|
69
69
|
|
|
@@ -87,7 +87,7 @@ input.onGesture(Gesture.Shake, function() {
|
|
|
87
87
|
})
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
## Step 7 @fullscreen
|
|
90
|
+
## {Step 7 @fullscreen}
|
|
91
91
|
|
|
92
92
|
Add a ``||basic:show leds||`` block inside the ``||logic:else||``. Make a picture of a scissors in the LEDs.
|
|
93
93
|
|
|
@@ -115,13 +115,13 @@ input.onGesture(Gesture.Shake, function() {
|
|
|
115
115
|
})
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
## Step 8 @fullscreen
|
|
118
|
+
## {Step 8 @fullscreen}
|
|
119
119
|
|
|
120
120
|
Click the ``+`` button again to add an ``||logic:else if||`` section. Now, add a conditional block for ``||logic:hand = 2||`` to the condition in ``||logic:else if||``. Since ``hand`` can only be `1`, `2`, or `3`, your code is covering all possible cases!
|
|
121
121
|
|
|
122
122
|

|
|
123
123
|
|
|
124
|
-
## Step 9 @fullscreen
|
|
124
|
+
## {Step 9 @fullscreen}
|
|
125
125
|
|
|
126
126
|
Get one more ``||basic:show leds||`` block and put it in the ``||logic:else if||``. Make a picture of a rock in the LEDs.
|
|
127
127
|
|
|
@@ -157,13 +157,13 @@ input.onGesture(Gesture.Shake, function() {
|
|
|
157
157
|
})
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
## Step 10 @fullscreen
|
|
160
|
+
## {Step 10 @fullscreen}
|
|
161
161
|
|
|
162
162
|
Click on the **SHAKE** button in the simulator and check to see that each image is showing up.
|
|
163
163
|
|
|
164
164
|

|
|
165
165
|
|
|
166
|
-
## Step 11 @fullscreen
|
|
166
|
+
## {Step 11 @fullscreen}
|
|
167
167
|
|
|
168
168
|
If you have a @boardname@, click on ``|Download|`` and follow the instructions to get the code
|
|
169
169
|
onto your @boardname@. Your game is ready! Gather your friends and play Rock Paper Scissors!
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Smiley Buttons
|
|
2
2
|
|
|
3
|
-
## Introduction @unplugged
|
|
3
|
+
## {Introduction @unplugged}
|
|
4
4
|
|
|
5
5
|
Code the buttons on the @boardname@ to show that it's happy or sad.
|
|
6
6
|
(Want to learn how the buttons works? [Watch this video](https://youtu.be/t_Qujjd_38o)).
|
|
7
7
|
|
|
8
8
|

|
|
9
9
|
|
|
10
|
-
## Step 1
|
|
10
|
+
## {Step 1}
|
|
11
11
|
|
|
12
12
|
Use the ``||input:on button pressed||`` block to run code when button **A** is pressed.
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ input.onButtonPressed(Button.A, function() {
|
|
|
16
16
|
})
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## Step 2
|
|
19
|
+
## {Step 2}
|
|
20
20
|
|
|
21
21
|
Place a ``||basic:show leds||`` block inside ``||input:on button pressed||`` to display a smiley on the screen. Press the **A** button in the simulator to see the smiley.
|
|
22
22
|
|
|
@@ -32,7 +32,7 @@ input.onButtonPressed(Button.A, function() {
|
|
|
32
32
|
})
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
## Step 3
|
|
35
|
+
## {Step 3}
|
|
36
36
|
|
|
37
37
|
Add ``||input:on button pressed||`` and ``||basic:show leds||`` blocks to display a frowny when button **B** is pressed.
|
|
38
38
|
|
|
@@ -48,7 +48,7 @@ input.onButtonPressed(Button.B, function() {
|
|
|
48
48
|
});
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
## Step 4
|
|
51
|
+
## {Step 4}
|
|
52
52
|
|
|
53
53
|
Add a secret mode that happens when **A** and **B** are pressed together. For this case, add multiple ``||basic:show leds||`` blocks to create an animation.
|
|
54
54
|
|
|
@@ -71,11 +71,11 @@ input.onButtonPressed(Button.AB, function() {
|
|
|
71
71
|
})
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
## Step 5
|
|
74
|
+
## {Step 5}
|
|
75
75
|
|
|
76
76
|
If you have a @boardname@, connect it to USB and click ``|Download|`` to transfer your code. Press button **A** on your @boardname@. Try button **B** and then **A** and **B** together.
|
|
77
77
|
|
|
78
|
-
## Step 6
|
|
78
|
+
## {Step 6}
|
|
79
79
|
|
|
80
80
|
Nice! Now go and show it off to your friends!
|
|
81
81
|
|