pxt-microbit 5.1.1 → 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.
- package/built/editor.js +36 -2
- package/built/hexcache/{523847a64a39d936972bb116ae62f3572fc68bbfaab239b9668a73843129f62d.hex → 21042ee1697f41e753f07ae4ed65b74e0d06c4cfd9e81c98522e5081cc22b22f.hex} +10923 -10920
- package/built/hexcache/{b3453e568175cf180eacd9bc7dbb01b5c8a3d08a615bc1f9c1da7291cd084375.hex → 3bd7683da9b220e850488838efa19f4472733744a11e01c17e4930cc48b4e0fa.hex} +10345 -10342
- package/built/hexcache/{104bed2beca960d761185d436978a3436467a15b22c67b375bcd19c41f329866.hex → 41b0eca0c15b68f1bb003a9857f7a3b6e54a9c073d9757bfe8d4b4a0396d5586.hex} +0 -0
- package/built/hexcache/{2b2b36e6358c0084c241a1cb9e35fa02042257df3c415d242d9b736c24743a0f.hex → ffda7a967870cc1be0cd9aa712c3d86444b9073804b3e2c0914c1b8ac3ca18ab.hex} +0 -0
- package/built/sim-strings.json +1 -17
- package/built/sim.js +1 -1
- package/built/target-strings.json +1 -52
- package/built/target.js +1 -44142
- package/built/target.json +1 -44142
- package/built/targetlight.json +1 -408
- package/built/theme.json +1 -2297
- package/built/web/blockly.css +1 -1
- package/built/web/react-common-authcode.css +4 -6773
- package/built/web/react-common-multiplayer.css +13 -0
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlblockly.css +1 -1
- package/built/web/rtlreact-common-authcode.css +13 -0
- package/built/web/rtlreact-common-multiplayer.css +13 -0
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +2 -2
- package/built/web/semantic.css +2 -2
- package/docs/SUMMARY.md +2 -0
- package/docs/device/pins.md +72 -40
- package/docs/device/v2.md +1 -1
- package/docs/extensions.md +40 -0
- package/docs/jacdac.md +60 -0
- package/docs/microcode.md +27 -0
- package/docs/projects/SUMMARY.md +16 -0
- package/docs/projects/electric-guitar/code.md +42 -0
- package/docs/projects/electric-guitar/make.md +40 -0
- package/docs/projects/electric-guitar.md +27 -0
- package/docs/projects/games.md +6 -0
- package/docs/projects/jonnys-bird.md +110 -0
- package/docs/projects/magic-button-trick.md +0 -2
- package/docs/projects/music.md +10 -0
- package/docs/projects/red-light-green-light.md +1 -1
- package/docs/projects/rock-paper-scissors-v2.md +201 -0
- package/docs/projects/v2-cat-napping.md +219 -0
- package/docs/projects.md +12 -0
- package/docs/reference/input/logo-is-pressed.md +1 -1
- package/docs/reference/input/on-logo-event.md +1 -1
- package/docs/reference/music/beat.md +1 -7
- package/docs/reference/music/change-tempo-by.md +5 -3
- package/docs/reference/music/play-tone.md +28 -15
- package/docs/reference/music/rest.md +28 -10
- package/docs/reference/music/ring-tone.md +7 -6
- package/docs/reference/music/set-tempo.md +7 -3
- package/docs/reference/serial/on-data-received.md +1 -1
- package/docs/reference/serial/read-buffer.md +8 -7
- package/docs/reference/serial/read-line.md +8 -6
- package/docs/reference/serial/read-string.md +4 -4
- package/docs/reference/serial/read-until.md +4 -4
- package/docs/reference/serial/redirect.md +8 -7
- package/docs/reference/serial/set-baud-rate.md +56 -0
- package/docs/reference/serial/set-write-line-padding.md +51 -0
- package/docs/reference/serial/write-buffer.md +4 -4
- package/docs/reference/serial/write-line.md +6 -6
- package/docs/reference/serial/write-number.md +6 -6
- package/docs/reference/serial/write-numbers.md +6 -6
- package/docs/reference/serial/write-string.md +5 -5
- package/docs/reference/serial/write-value.md +3 -3
- package/docs/reference/serial.md +4 -1
- package/docs/translate.md +53 -22
- package/docs/tutorials-v2.md +6 -0
- package/docs/windows-app.md +3 -3
- package/package.json +2 -2
- package/pxtarget.json +7 -4
- package/targetconfig.json +19 -5
package/docs/SUMMARY.md
CHANGED
|
@@ -295,6 +295,8 @@
|
|
|
295
295
|
* [on data received](/reference/serial/on-data-received)
|
|
296
296
|
* [redirect](/reference/serial/redirect)
|
|
297
297
|
* [redirect to usb](/reference/serial/redirect-to-usb)
|
|
298
|
+
* [set baud rate](/reference/serial/set-baud-rate)
|
|
299
|
+
* [set write line padding](/reference/serial/set-write-line-padding)
|
|
298
300
|
* [write buffer](/reference/serial/write-buffer)
|
|
299
301
|
* [read buffer](/reference/serial/read-buffer)
|
|
300
302
|
* [Control](/reference/control)
|
package/docs/device/pins.md
CHANGED
|
@@ -1,64 +1,96 @@
|
|
|
1
1
|
# micro:bit pins
|
|
2
2
|
|
|
3
|
-
The micro:bit pins
|
|
3
|
+
The micro:bit has **25** external connections on the edge connector of the board, which are referred to as 'pins'. The edge connector is the gold area on the right side of board as shown the figure below.
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
There are five large pins, that are also connected to holes in the board labelled: 0, 1, 2, 3V, and GND. And along the same edge, there are 20 small pins that you can use when plugging the micro:bit into an edge connector.
|
|
7
|
+
There are **5 large pins** that are also connected to holes in the board labelled: **0**, **1**, **2**, **3V**, and **GND**. And along the same edge, there are **20 small pins** that you can use when plugging the micro:bit into an edge connector.
|
|
10
8
|
|
|
11
9
|
## Large pins
|
|
12
10
|
|
|
13
|
-
You can easily attach crocodile clips or 4mm banana plugs to the
|
|
11
|
+
You can easily attach crocodile clips or 4mm banana plugs to the **5** large pins.
|
|
14
12
|
|
|
15
|
-
The first three, labelled 0
|
|
13
|
+
The first three, labelled **0**, **1** and **2** are flexible and can be used for many different things - which means they are often called "general purpose input and output" (shortened to GPIO). These three pins also have the ability to read analog voltages using something called an analog-to-digital converter (ADC). They all have the same function:
|
|
16
14
|
|
|
17
|
-
* **0**: GPIO (general purpose digital input and output) with
|
|
15
|
+
* **0**: GPIO (general purpose digital input and output) with analog-to-digital convertor (ADC).
|
|
18
16
|
* **1**: GPIO with ADC
|
|
19
17
|
* **2**: GPIO with ADC
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
With the micro:bit V2, pins **0**, **1**, **2**, and the **LOGO** can also be set to work as [capacitive touch](/reference/pins/touch-set-mode) buttons.
|
|
20
|
+
|
|
21
|
+
### Power pins
|
|
22
|
+
|
|
23
|
+
The other two large pins (**3V** and **GND**) are very different!
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
### ~hint
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
For details on the power, current and voltage limitations of the board, see [Power Supply](https://tech.microbit.org/hardware/powersupply/)
|
|
27
|
+
#### Be careful with the power pins
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
Watch out! The pins labelled **3V** and **GND** relate to the power supply of the board, and they should NEVER be connected together.
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
For details on the power, current and voltage limitations of the board, see [Power Supply](https://tech.microbit.org/hardware/powersupply/).
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
* **GND**: attaches to ground in order to complete a circuit (required when using the 3V pin)
|
|
33
|
+
### ~
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
* **3V**: 3 volt *power output* or *power input*:
|
|
37
|
+
>* *power output*: If the micro:bit is powered by USB or a battery, then you can use the **3V** pin as a power output to power peripherals with.
|
|
38
|
+
>* *power input*: If the micro:bit is NOT being powered by USB or battery, you can use the **3V** pin to supply power input to the micro:bit.
|
|
39
|
+
* **GND**: attaches to ground in order to complete a circuit (required when using the **3V** pin)
|
|
40
|
+
|
|
41
|
+
If you hold the **GND** pin with one hand, you can program the microbit to detect yourself touching the **0**, **1** or **2** pins with your other hand, giving you three more buttons to experiment with (you just used your body to complete an electrical circuit to make "resistive touch" buttons).
|
|
36
42
|
|
|
37
43
|
## Small pins
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Unlike the three large pins that are dedicated to being used for external connections, some of the small pins are shared with other components on the micro:bit board. For example, pin 3 is shared with some of the LEDs on the screen of the micro:bit, so if you are using the screen to scroll messages, you can’t use this pin as well.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
The **20** small pins are numbered sequentially from **3-22** (these pins are not labeled on the micro:bit, however, they are labelled in the picture above).
|
|
46
|
+
|
|
47
|
+
Unlike the three large pins that are dedicated to being used for external connections, some of the small pins are shared with other components on the micro:bit board. For example, pin **3** is shared with some of the LEDs on the screen of the micro:bit, so if you are using the screen to scroll messages, you can’t use this pin as well.
|
|
48
|
+
|
|
49
|
+
There are some differences in function assignments for the small pins between the micro:bit versions. The following pin tables describe the pin functions for each version.
|
|
50
|
+
|
|
51
|
+
### V1 pin map
|
|
52
|
+
|
|
53
|
+
| Pin | Description |
|
|
54
|
+
| - | - |
|
|
55
|
+
| **3** | GPIO shared with LED Col 1 of the LED screen; can be used for ADC and digital I/O when the LED screen is turned off. |
|
|
56
|
+
| **4** | GPIO shared with LED Col 2 of the LED screen; can be used for ADC and digital I/O when the LED screen is turned off. |
|
|
57
|
+
| **5** | GPIO shared with Button A. This lets you trigger or detect a button "A" click externally. This pin has a pull-up resistor, which means that by default it is at voltage of 3V. To replace button A on the micro:bit with an external button, connect one end of the external button to pin 5 and the other end to GND. When the button is pressed, the voltage on pin 5 is pulled down to 0, which generates a button click event. |
|
|
58
|
+
| **6** | GPIO shared with LED Col 9 of the LED screen; can be used for digital I/O when the LED screen is turned off. |
|
|
59
|
+
| **7** | GPIO shared with LED Col 8 of the LED screen; can be used for digital I/O when the LED screen is turned off. |
|
|
60
|
+
| **8** | Dedicated GPIO, for sending and sensing digital signals.
|
|
61
|
+
| **9** | GPIO shared with LED Col 7 of the LED screen; can be used for digital I/O when the LED screen is turned off. |
|
|
62
|
+
| **10** | GPIO shared with LED Col 3 of the LED screen; can be used for ADC and digital I/O when the LED screen is turned off.|
|
|
63
|
+
| **11** | GPIO shared with Button B. This lets you trigger or detect a button "B" click externally. |
|
|
64
|
+
| **12** | This GPIO pin has been reserved to provide support for accessibility. |
|
|
65
|
+
| **13** | GPIO that is conventionally used for the serial clock (SCK) signal of the 3-wire Serial Peripheral Interface (SPI) bus. |
|
|
66
|
+
| **14** | GPIO that is conventionally used for the Master In Slave Out (MISO) signal of the SPI bus. |
|
|
67
|
+
| **15** | GPIO that is conventionally used for the Master Out Slave In (MOSI) signal of the SPI bus. |
|
|
68
|
+
| **16** | Dedicated GPIO (conventionally also used for SPI 'Chip Select' function). |
|
|
69
|
+
| **17, 18** | These pins are wired to the 3V supply, like the large '3V' pad. |
|
|
70
|
+
| **19, 20** | Implement the clock signal (SCL) and data line (SDA) of the I2C bus communication protocol. With I2C, several devices can be connected on the same bus and send/read messages to and from the CPU. Internally, the accelerometer and the compass are connected to i2c. |
|
|
71
|
+
| **21, 22** | These pins are wired to the GND pin and serve no other function. |
|
|
72
|
+
|
|
73
|
+
### V2 pin map
|
|
74
|
+
|
|
75
|
+
| Pin | Description |
|
|
76
|
+
| - | - |
|
|
77
|
+
| **3** | GPIO shared with LED Col 3 of the LED screen; can be used for ADC and digital I/O when the LED screen is turned off. |
|
|
78
|
+
| **4** | GPIO shared with LED Col 1 of the LED screen; can be used for ADC and digital I/O when the LED screen is turned off. |
|
|
79
|
+
| **5** | GPIO shared with Button A. This lets you trigger or detect a button "A" click externally. This pin has a pull-up resistor, which means that by default it is at voltage of 3V. To replace button A on the micro:bit with an external button, connect one end of the external button to pin 5 and the other end to GND. When the button is pressed, the voltage on pin 5 is pulled down to 0, which generates a button click event. |
|
|
80
|
+
| **6** | GPIO shared with LED Col 2 of the LED screen; can be used for digital I/O when the LED screen is turned off. |
|
|
81
|
+
| **7** | GPIO shared with LED Col 4 of the LED screen; can be used for digital I/O when the LED screen is turned off. |
|
|
82
|
+
| **8, 9** | Dedicated GPIO, for sending and sensing digital signals; can also be configured for NFC. |
|
|
83
|
+
| **10** | GPIO shared with LED Col 5 of the LED screen; can be used for ADC and digital I/O when the LED screen is turned off.|
|
|
84
|
+
| **11** | GPIO shared with Button B. This lets you trigger or detect a button "B" click externally. |
|
|
85
|
+
| **12** | This GPIO pin has been reserved to provide support for accessibility. |
|
|
86
|
+
| **13** | GPIO that is conventionally used for the serial clock (SCK) signal of the 3-wire Serial Peripheral Interface (SPI) bus. |
|
|
87
|
+
| **14** | GPIO that is conventionally used for the Master In Slave Out (MISO) signal of the SPI bus. |
|
|
88
|
+
| **15** | GPIO that is conventionally used for the Master Out Slave In (MOSI) signal of the SPI bus. |
|
|
89
|
+
| **16** | Dedicated GPIO (conventionally also used for SPI 'Chip Select' function). |
|
|
90
|
+
| **17, 18** | These pins are wired to the 3V supply, like the large '3V' pad. |
|
|
91
|
+
| **19, 20** | Implement the clock signal (SCL) and data line (SDA) of the I2C bus communication protocol. With I2C, several devices can be connected on the same bus and send/read messages to and from the CPU. Internally, the accelerometer and the compass are connected to i2c. |
|
|
92
|
+
| **21, 22** | These pins are wired to the GND pin and serve no other function. |
|
|
60
93
|
|
|
61
94
|
## Connecting to the small pins
|
|
62
95
|
|
|
63
|
-
It is recommended that an edge connector be
|
|
64
|
-
|
|
96
|
+
It is recommended that an edge connector designed for the micro:bit be used for connections to the small pins. For available edge connectors, put "edge eonnectors for the micro:bit" into your internet search engine to find an accessory supplier.
|
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
|

|
|
59
59
|
|
|
60
60
|
* red power LED next to the USB connect
|
|
61
|
-
* large black
|
|
61
|
+
* large black speaker component centrally located in the back and rotated by 45 degrees
|
|
62
62
|
* slanted radio antenna
|
|
63
63
|
|
|
64
64
|

|
package/docs/extensions.md
CHANGED
|
@@ -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
|
|
|
@@ -310,6 +314,10 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
|
|
|
310
314
|
|
|
311
315
|
```codecard
|
|
312
316
|
[{
|
|
317
|
+
"name": "DFRobot IoT Cloud Kit",
|
|
318
|
+
"url":"/pkg/DFRobot/pxt-DFRobot_IoT_Cloud_Kit",
|
|
319
|
+
"cardType": "package"
|
|
320
|
+
}, {
|
|
313
321
|
"name": "iClass IoT",
|
|
314
322
|
"url":"/pkg/KelieLeung/pxt-iClassIoT",
|
|
315
323
|
"cardType": "package"
|
|
@@ -411,6 +419,10 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
|
|
|
411
419
|
"name": "Minode Kit",
|
|
412
420
|
"url":"/pkg/minodekit/pxt-minode",
|
|
413
421
|
"cardType": "package"
|
|
422
|
+
}, {
|
|
423
|
+
"name": "DFRobot Boson Kit",
|
|
424
|
+
"url":"/pkg/dfrobot/pxt-dfrobot_bosonkit",
|
|
425
|
+
"cardType": "package"
|
|
414
426
|
}]
|
|
415
427
|
```
|
|
416
428
|
|
|
@@ -481,6 +493,14 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
|
|
|
481
493
|
|
|
482
494
|
```codecard
|
|
483
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
|
+
}, {
|
|
484
504
|
"name": "Elecfreaks XGO",
|
|
485
505
|
"url":"/pkg/elecfreaks/pxt-xgo",
|
|
486
506
|
"cardType": "package"
|
|
@@ -632,6 +652,10 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
|
|
|
632
652
|
"name": "ReroKit rero:micro",
|
|
633
653
|
"url":"/pkg/ReRoKit/pxt-reromicro",
|
|
634
654
|
"cardType": "package"
|
|
655
|
+
}, {
|
|
656
|
+
"name": "PLEN bit full",
|
|
657
|
+
"url":"/pkg/plenprojectcompany/pxt-PLENbit_full",
|
|
658
|
+
"cardType": "package"
|
|
635
659
|
}, {
|
|
636
660
|
"name": "PLEN bit",
|
|
637
661
|
"url":"/pkg/plenprojectcompany/pxt-PLENbit",
|
|
@@ -735,6 +759,14 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
|
|
|
735
759
|
|
|
736
760
|
```codecard
|
|
737
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
|
+
}, {
|
|
738
770
|
"name": "DFRobot Environment Science Board ",
|
|
739
771
|
"url":"/pkg/DFRobot/pxt-DFRobot_Environment_Science",
|
|
740
772
|
"cardType": "package"
|
|
@@ -864,6 +896,14 @@ Check out [the accessories pages on microbit.org](https://microbit.org/buy/acces
|
|
|
864
896
|
## Utilities
|
|
865
897
|
```codecard
|
|
866
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
|
+
}, {
|
|
867
907
|
"name": "Bluetooth HID",
|
|
868
908
|
"url":"/pkg/bsiever/microbit-pxt-blehid",
|
|
869
909
|
"cardType": "package"
|
package/docs/jacdac.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Jacdac
|
|
2
|
+
|
|
3
|
+
Connect and Code. Instantly.
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
[Jacdac](https://aka.ms/jacdac) is a plug-and-play hardware accessory system that provides simulation and physical device twin in MakeCode.
|
|
8
|
+
|
|
9
|
+
```codecard
|
|
10
|
+
[{
|
|
11
|
+
"name": "Getting started",
|
|
12
|
+
"description": "Connect and Code. Instantly in MakeCode.",
|
|
13
|
+
"url":"https://microsoft.github.io/jacdac-docs/clients/makecode/",
|
|
14
|
+
"imageUrl": "/static/jacdac/getting-started.jpg"
|
|
15
|
+
}]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Projects
|
|
19
|
+
|
|
20
|
+
```codecard
|
|
21
|
+
[
|
|
22
|
+
{
|
|
23
|
+
"name": "Button smasher",
|
|
24
|
+
"description": "How many times can you smash the button in 10 seconds?",
|
|
25
|
+
"url": "https://microsoft.github.io/jacdac-docs/clients/makecode/projects/button-smasher/",
|
|
26
|
+
"imageUrl": "/static/jacdac/button-smasher.jpg",
|
|
27
|
+
"youTubeId": "rlK_8oqMAmo"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "Slider Sound Bender",
|
|
31
|
+
"description": "Create twisted sounds using a slider module.",
|
|
32
|
+
"url": "https://microsoft.github.io/jacdac-docs/clients/makecode/projects/slider-sound-bender/",
|
|
33
|
+
"imageUrl": "/static/jacdac/slider-sound-bender.jpg"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "Light Sound Bender",
|
|
37
|
+
"description": "Create twisted sounds using light levels",
|
|
38
|
+
"url": "https://microsoft.github.io/jacdac-docs/clients/makecode/projects/light-sound-bender/",
|
|
39
|
+
"imageUrl": "/static/jacdac/light-sound-bender.jpg"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "Rotary Sound Bender",
|
|
43
|
+
"description": "Create twisted sounds using a rotary encoder module.",
|
|
44
|
+
"url": "https://microsoft.github.io/jacdac-docs/clients/makecode/projects/rotary-sound-bender/",
|
|
45
|
+
"imageUrl": "/static/jacdac/rotary-sound-bender.jpg"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "Sound LED",
|
|
49
|
+
"description": "Show the sound level on a LED ring",
|
|
50
|
+
"url": "https://microsoft.github.io/jacdac-docs/clients/makecode/projects/sound-led/",
|
|
51
|
+
"imageUrl": "/static/jacdac/sound-led.jpg"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "Magnetic Sound Bender",
|
|
55
|
+
"description": "Create twisted sounds using a magnet",
|
|
56
|
+
"url": "https://microsoft.github.io/jacdac-docs/clients/makecode/projects/magnetic-sound-bender/",
|
|
57
|
+
"imageUrl": "/static/jacdac/magnetic-sound-bender.jpg"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
```
|
|
@@ -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
|
+
```
|
package/docs/projects/SUMMARY.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* [Morse Chat](/projects/v2-morse-chat)
|
|
14
14
|
* [Clap Lights](/projects/v2-clap-lights)
|
|
15
15
|
* [Blow Away](/projects/v2-blow-away)
|
|
16
|
+
* [Cat Napping](/projects/v2-cat-napping)
|
|
16
17
|
* [Live Coding](/live-coding)
|
|
17
18
|
* [Flashing Heart](https://youtu.be/NvEOKZ8wh9s)
|
|
18
19
|
* [Name Tag](https://youtu.be/xpRI5jjQ31E)
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
* [PlayList](https://www.youtube.com/playlist?list=PLMMBk9hE-SepocOwueEtTDyOPI_TBE9yC)
|
|
50
51
|
* [Games](/projects/games)
|
|
51
52
|
* [Rock Paper Scissors](/projects/rock-paper-scissors)
|
|
53
|
+
* [Rock Paper Scissors V2](/projects/rock-paper-scissors-v2)
|
|
52
54
|
* [Coin Flipper](/projects/coin-flipper)
|
|
53
55
|
* [7 seconds](/projects/7-seconds)
|
|
54
56
|
* [Hot Potato](/projects/hot-potato)
|
|
@@ -83,6 +85,8 @@
|
|
|
83
85
|
* [Hack Your Headphones](/projects/hack-your-headphones)
|
|
84
86
|
* [Banana Keyboard](/projects/banana-keyboard)
|
|
85
87
|
* [Guitar](/projects/guitar)
|
|
88
|
+
* [Jonny's Bird](/projects/jonnys-bird)
|
|
89
|
+
* [Electric Guitar](/projects/electric-guitar)
|
|
86
90
|
* [Toys](/projects/toys)
|
|
87
91
|
* [Inchworm](/projects/inchworm)
|
|
88
92
|
* [Milk Carton Robot](/projects/milk-carton-robot)
|
|
@@ -138,6 +142,18 @@
|
|
|
138
142
|
* [Kitronik Inventor Kit](https://www.kitronik.co.uk/blog/inventors-kit-experiment-1-help)
|
|
139
143
|
* [micro:bit of Things](https://sites.google.com/view/microbitofthings)
|
|
140
144
|
* [A-Z Robotics](https://tinkerspark.teachable.com/)
|
|
145
|
+
* [Jacdac](/jacdac)
|
|
146
|
+
* [Getting started](https://microsoft.github.io/jacdac-docs/clients/makecode/)
|
|
147
|
+
* [Button smasher](https://microsoft.github.io/jacdac-docs/clients/makecode/projects/button-smasher/)
|
|
148
|
+
* [Slider Sound Bender](https://microsoft.github.io/jacdac-docs/clients/makecode/projects/slider-sound-bender/)
|
|
149
|
+
* [Light Sound Bender](https://microsoft.github.io/jacdac-docs/clients/makecode/projects/light-sound-bender/)
|
|
150
|
+
* [Rotary Sound Bender](https://microsoft.github.io/jacdac-docs/clients/makecode/projects/rotary-sound-bender/)
|
|
151
|
+
* [Sound LED](https://microsoft.github.io/jacdac-docs/clients/makecode/projects/sound-led/)
|
|
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)
|
|
141
157
|
* [Behind the MakeCode Hardware](/behind-the-makecode-hardware)
|
|
142
158
|
* [LEDs](https://youtu.be/qqBmvHD5bCw)
|
|
143
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
|
+

|
|
27
|
+
|
|
28
|
+
Here are two pictures of the finished electric guitar with its connections:
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+

|
|
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
|
+
## ~
|
package/docs/projects/games.md
CHANGED
|
@@ -24,6 +24,12 @@ Fun games to build with your @boardname@.
|
|
|
24
24
|
"cardType": "tutorial"
|
|
25
25
|
}]
|
|
26
26
|
}, {
|
|
27
|
+
"name": "Rock Paper Scissors V2",
|
|
28
|
+
"url":"/projects/rock-paper-scissors-v2",
|
|
29
|
+
"description": "Rock Paper Scissors with Sounds for micro:bit V2!",
|
|
30
|
+
"imageUrl":"/static/mb/projects/a4-motion-v2.png",
|
|
31
|
+
"cardType": "tutorial"
|
|
32
|
+
},{
|
|
27
33
|
"name": "Coin Flipper",
|
|
28
34
|
"url":"/projects/coin-flipper",
|
|
29
35
|
"description": "Guess the coin toss and see if you're lucky.",
|
|
@@ -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!
|
|
@@ -8,8 +8,6 @@ Build a magic trick that uses the @boardname@'s compass to detect a nearby magne
|
|
|
8
8
|
|
|
9
9
|
This is a simple magic trick you can perform to amaze your friends! When you move the sticky labels on your @boardname@'s **A** and **B** button, you appear to make the buttons really switch over. To see the trick performed watch the video below.
|
|
10
10
|
|
|
11
|
-
https://youtu.be/-9KvmPopov8
|
|
12
|
-
|
|
13
11
|
## How the trick works
|
|
14
12
|
|
|
15
13
|
The **magic** here is really in the code. This trick uses a magnet, hidden in your hand, to tell the @boardname@ to swap over the buttons. When the magnet is near the @boardname@, the **A** button starts working like the **B** button and the **B** button starts working like the **A** button. Tricky!
|