2
2
3
3
### @explicitHints true
4
4
5
- ## Introduction @unplugged
5
+ ## Code a micro : bit emoji! @unplugged
6
6
7
7
Code the buttons on the @boardname @ to show that it's happy or sad.
8
8
(Want to learn how the buttons works? [ Watch this video] ( https://youtu.be/t_Qujjd_38o ) ).
9
9
10
10
![ Pressing the A and B buttons] ( /static/mb/projects/smiley-buttons/sim.gif )
11
11
12
- ## Step 1
12
+ ## { Step 1}
13
13
14
14
Put in an `` ||input:on button pressed|| `` event to run code when button ** A** is pressed.
15
15
@@ -19,7 +19,7 @@ def on_button_pressed_a():
19
19
input .on_button_pressed(Button.A, on_button_pressed_a)
20
20
```
21
21
22
- ## Step 2
22
+ ## { Step 2}
23
23
24
24
Use `` ||basic:show icon|| `` to display a ** Happy** face on the screen.
25
25
@@ -31,7 +31,7 @@ def on_button_pressed_a():
31
31
input .on_button_pressed(Button.A, on_button_pressed_a)
32
32
```
33
33
34
- ## Step 3
34
+ ## { Step 3}
35
35
36
36
Use another `` ||input:on button pressed|| `` with a `` ||basic:show icon|| `` inside to display a ** Sad** face when button ** B** is pressed.
37
37
@@ -41,7 +41,7 @@ def on_button_pressed_a2():
41
41
input .on_button_pressed(Button.B, on_button_pressed_a2)
42
42
```
43
43
44
- ## Step 4
44
+ ## { Step 4}
45
45
46
46
Add a secret mode that happens when ** A** and ** B** are pressed together. For this case, use `` ||basic:show icon|| `` multiple times to create an animation.
47
47
@@ -52,10 +52,6 @@ def on_button_pressed_a3():
52
52
input .on_button_pressed(Button.AB , on_button_pressed_a3)
53
53
```
54
54
55
- ## Step 5
55
+ ## { Step 5}
56
56
57
57
Click `` |Download| `` to transfer your code to your @boardname @ (if you have one). Try buttons ** A** , ** B** and then ** A** and ** B** together.
58
-
59
- ## Step 6
60
-
61
- If you have a @boardname @ connected, click `` |Download| `` and transfer your code to the @boardname @!
0 commit comments