pxt-microbit 5.1.25 → 5.1.27
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 +34 -3
- package/built/sim.d.ts +11 -0
- package/built/sim.js +123 -50
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.json +1 -1
- package/built/theme.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 +2 -2
- package/built/web/semantic.css +2 -2
- package/docs/courses/logic-lab/elements.md +8 -1
- package/docs/courses/logic-lab/explorer.md +11 -4
- package/docs/courses/logic-lab/expressions.md +10 -4
- package/docs/courses/logic-lab/logic-gates.md +7 -1
- package/docs/courses/logic-lab/programmable.md +3 -3
- package/docs/courses/logic-lab.md +7 -1
- package/docs/reference/music/on-event.md +1 -1
- package/package.json +3 -3
- package/pxtarget.json +2 -64
|
@@ -6,7 +6,7 @@ Whether creating equations in Boolean algebra or using them in your programs, yo
|
|
|
6
6
|
|
|
7
7
|
Boolean (logical) equations are expressed in a way similar to mathmatical equations. Variables in Boolean expressions though, have only two possible values, ``true`` or ``false``. For an equation using a logical expression, the equivalant sides of the equal sign ,``=``, will be only ``true`` or ``false`` too.
|
|
8
8
|
|
|
9
|
-
The following list shows the basic notation elements for Boolean expressions
|
|
9
|
+
The following list shows the basic notation elements for variables and operators in Boolean expressions:
|
|
10
10
|
|
|
11
11
|
* ``~A``: the inverse (**NOT**) of ``A``, when ``A`` is ``true``, ``~A`` is ``false``
|
|
12
12
|
* ``A + B``: the value of ``A`` **OR** ``B``
|
|
@@ -205,3 +205,10 @@ F | F | F
|
|
|
205
205
|
T | F | T
|
|
206
206
|
F | T | T
|
|
207
207
|
T | T | F
|
|
208
|
+
<br/>
|
|
209
|
+
|
|
210
|
+
## ~button /courses/logic-lab/explorer
|
|
211
|
+
|
|
212
|
+
NEXT: Logic Explorer
|
|
213
|
+
|
|
214
|
+
## ~
|
|
@@ -4,7 +4,7 @@ As a way to see how the basic logical operators work, we'll make a program to te
|
|
|
4
4
|
|
|
5
5
|
## Inputs and output
|
|
6
6
|
|
|
7
|
-
Make an array called ``||variables:inputs||`` with two values, ``false`` and ``true``, as logical inputs. Add another variable ``||variables:Q||`` to receive the resulting value of a logical expression as output.
|
|
7
|
+
Make an ``||arrays:array||`` called ``||variables:inputs||`` with two values, ``false`` and ``true``, as logical inputs. Add another variable ``||variables:Q||`` to receive the resulting value of a logical expression as output.
|
|
8
8
|
|
|
9
9
|
```blocks
|
|
10
10
|
let inputs = [false, true]
|
|
@@ -17,7 +17,7 @@ To start with, we'll make a single input test for the variable ``||variables:A||
|
|
|
17
17
|
|
|
18
18
|
1. Get a ``||loops:for element||`` loop and put it in the ``||loops:on start||``. Rename the ``||variables:index||`` variable to ``||variables:A||`` and switch the ``||variables:list||`` variable to ``||variables:inputs||``.
|
|
19
19
|
2. Pull a ``||variables:set Q to||`` block into the ``||loops:for element||`` loop and set the value to ``||logic:false||``.
|
|
20
|
-
3. Go find the ``||logic:if then else||`` and put in below the ``||variables:set Q to||``. Pick up a ``||variables:Q||``
|
|
20
|
+
3. Go find the ``||logic:if then else||`` and put in below the ``||variables:set Q to||``. Pick up a ``||variables:Q||`` from the ``||variables:VARIABLES||`` Toolbox drawer and drop it onto the ``||logic:false||`` to replace it.
|
|
21
21
|
4. Move a ``||basic:show icon||`` inside the ``||logic:if then||`` section and change the image to a ``t-shirt``. This is our image for a ``true`` output.
|
|
22
22
|
5. Move a ``||basic:show icon||`` inside the ``||logic:else||`` section and change the image to a ``small diamond``. This is our image for a ``false`` output.
|
|
23
23
|
6. Just below the ``||logic:if then else||``, put in a ``||loops:pause||``, a ``||basic:clear screen||``, and another ``||basic:pause||`` block. Set the time for each ``||basic:pause||`` to ``500``.
|
|
@@ -143,7 +143,7 @@ A | B | A · B
|
|
|
143
143
|
|
|
144
144
|
## XOR test
|
|
145
145
|
|
|
146
|
-
To test XOR, we'll use the XOR expression from [Boolean elements](/courses/logic-lab/elements#xor). Drag and place the ``||logic:LOGIC||`` blocks to make the ``||variables:Q||`` equation to look like this:
|
|
146
|
+
To test XOR, we'll use the XOR expression from [Boolean elements](/courses/logic-lab/elements#xor). Drag and place the ``||logic:LOGIC||`` blocks in to make the ``||variables:Q||`` equation to look like this:
|
|
147
147
|
|
|
148
148
|
```block
|
|
149
149
|
let A = false
|
|
@@ -159,4 +159,11 @@ A | B | A ⊕ B
|
|
|
159
159
|
**false** | **false** | ``[basic.showIcon(IconNames.SmallDiamond)]``
|
|
160
160
|
**false** | **true** | ``[basic.showIcon(IconNames.TShirt)]``
|
|
161
161
|
**true** | **false** | ``[basic.showIcon(IconNames.TShirt)]``
|
|
162
|
-
**true** | **true** | ``[basic.showIcon(IconNames.SmallDiamond)]``
|
|
162
|
+
**true** | **true** | ``[basic.showIcon(IconNames.SmallDiamond)]``
|
|
163
|
+
<br/>
|
|
164
|
+
|
|
165
|
+
## ~button /courses/logic-lab/logic-gates
|
|
166
|
+
|
|
167
|
+
NEXT: Logic Gates
|
|
168
|
+
|
|
169
|
+
## ~
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Logic and expressions
|
|
2
2
|
|
|
3
|
-
The use and study of _logic_ involves finding a new fact by analyzing whether some other facts together can prove to be true. Some facts, or conditions, when looked at together may prove another fact to be true, or maybe false.
|
|
3
|
+
The use and study of _logic_ involves finding a new fact by analyzing whether some other facts, when brought together, can prove that fact to be true. Some facts, or conditions, when looked at together may prove another fact to be true, or maybe false.
|
|
4
4
|
|
|
5
|
-
If the temperature outside is below freezing and you don't have a coat, you will feel cold. If you're not sick, then you will feel well. If you can swim or ride in a boat
|
|
5
|
+
If the temperature outside is below freezing and you don't have a coat, you will feel cold. If you're not sick, then you will feel well. If you can swim or ride in a boat on water, you will stay afloat. These are statements of fact that result from some condition being true.
|
|
6
6
|
|
|
7
7
|
## Truth statements
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ By taking some facts and putting them into a logical form, we can make an arithm
|
|
|
12
12
|
* **NOT** ``sick`` **=** ``I feel well``
|
|
13
13
|
* ``I can swim`` **OR** ``I'm in a boat`` **=** ``I'm floating``
|
|
14
14
|
|
|
15
|
-
You see the AND, NOT, and OR in the example word equations? These are our logical _operators_. Every day we make decisions when we think about one or more facts together using these operators. Sometimes, it's necessary for all facts to be true in order for the conclusion to be true. This is the case when the AND operator is used. When analyzing facts with the OR operator, only
|
|
15
|
+
You see the AND, NOT, and OR in the example word equations? These are our logical _operators_. Every day we make decisions when we think about one or more facts together using these operators. Sometimes, it's necessary for all facts to be true in order for the conclusion to be true. This is the case when the AND operator is used. When analyzing facts with the OR operator, only one fact needs to be true for the conclusion to be true also.
|
|
16
16
|
|
|
17
17
|
Making a decision may require more than just one or two facts. When this happens, another operator is needed to combine the facts together to make a conclusion. In the last example word equation, you actually might not be floating if just those two condtions are true. To correctly prove that you're actually floating, you need to state that you're in water too.
|
|
18
18
|
|
|
@@ -109,7 +109,7 @@ Because you feel cold only when both conditions are true, the statement becomes
|
|
|
109
109
|
|
|
110
110
|
``A · B`` = ``Q``
|
|
111
111
|
|
|
112
|
-
A truth table for the variables in the expression have the same values as the table for the truth statement (``true`` and ``false`` are abbreviated to just ``T`` and ``F``).
|
|
112
|
+
A truth table for the Boolean variables in the expression have the same values as the table for the truth statement (``true`` and ``false`` are abbreviated to just ``T`` and ``F``).
|
|
113
113
|
|
|
114
114
|
A | B | Q
|
|
115
115
|
-|-|-
|
|
@@ -140,3 +140,9 @@ T | F | F
|
|
|
140
140
|
To write a Boolean equation for when you feel cold, we find the condtions in the table where ``Q`` is ``true``. Here we see that you will feel cold only in one row, when condition ``A`` is ``true`` and condtion ``B`` is ``false``. The Boolean equation for these conditions is this:
|
|
141
141
|
|
|
142
142
|
``A · ~B`` = ``Q``
|
|
143
|
+
|
|
144
|
+
## ~button /courses/logic-lab/elements
|
|
145
|
+
|
|
146
|
+
NEXT: Boolean Elements
|
|
147
|
+
|
|
148
|
+
## ~
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
In the real world digital devices aren't the abstract logical expressions of Boolean algebra, but they are implementations of these expressions in hardware. The logical expressions are translated into device structures called _logic gates_. A logic gate is both a symbolic representation of a logical operation and, when used in digital electronics, it
|
|
5
|
+
In the real world digital devices aren't the abstract logical expressions of Boolean algebra, but they are implementations of these expressions in hardware. The logical expressions are translated into device structures called _logic gates_. A logic gate is both a symbolic representation of a logical operation and, when used in digital electronics, it is an actual circuit in hardware. A single logic gate is usually made of several transistors an shares space with many others in an integrated circuit.
|
|
6
6
|
|
|
7
7
|
Each of the basic operators we learned about in the [expressions](/courses/logic-lab/expressions) section have a gate symbol. The symbol takes the place of the operator and the variables are the inputs to the gate. The resulting value from the expression equation is the output of the gate. The output of a gate can be a final result or it can be connected as an input to yet another gate.
|
|
8
8
|
|
|
@@ -85,3 +85,9 @@ When this equation is converted to logic gates, there's one fewer gate than in t
|
|
|
85
85
|

|
|
86
86
|
|
|
87
87
|
This diagram has less complexity than the first one. Reduction in the number of gates to accomplish the same logical result is one of the primary goals for digital logic design. For electronic devices, this allows more gates to use the limited amount of space on an integrated circuit.
|
|
88
|
+
|
|
89
|
+
## ~button /courses/logic-lab/programmable
|
|
90
|
+
|
|
91
|
+
NEXT: Programmable Logic
|
|
92
|
+
|
|
93
|
+
## ~
|
|
@@ -135,9 +135,9 @@ if (pins.digitalReadPin(DigitalPin.P6) > 0) {
|
|
|
135
135
|
|
|
136
136
|
You can test different input combinations by connecting the other ends of alligator clip leads on pins **P0** and **P1** to either **GND** or **3V**. The **GND** pin will make a ``false`` input value and **3V** will make a ``true`` input value.
|
|
137
137
|
|
|
138
|
-
If you have an expansion connector for your @boardname@, you can use the combined logic script and the logic observer code to check each ouptput. Move the other end alligator clip lead connected to the observer pin **P6** to each of the outputs **P2**, **P3**, and **P4** to see the result of the logic operation programmed for those pins.
|
|
138
|
+
If you have an expansion connector for your @boardname@, you can use the combined logic script and the logic observer code to check each ouptput. Move the other end of the alligator clip lead connected to the observer pin **P6** to each of the outputs **P2**, **P3**, and **P4** to see the result of the logic operation programmed for those pins.
|
|
139
139
|
|
|
140
|
-
If you just have the @boardname@ by itself, you can test each logic function using only the scripts for each logic gate. Just put the script inside a ``||loops:forever||`` and place a ``||basic:show string||`` block with the logic letter after each ``||pins:digital write pin||``.
|
|
140
|
+
If you just have the @boardname@ by itself, you can test each logic function using only the scripts for each logic gate. Just put the script inside a ``||loops:forever||`` loop and place a ``||basic:show string||`` block with the logic letter after each ``||pins:digital write pin||``.
|
|
141
141
|
|
|
142
142
|
This is the code for the **NOT** gate:
|
|
143
143
|
|
|
@@ -164,7 +164,7 @@ GND | 3V | ``[basic.showString("T")]``
|
|
|
164
164
|
3V | GND | ``[basic.showString("F")]``
|
|
165
165
|
<br/>
|
|
166
166
|
|
|
167
|
-
Do test connections for the inputs
|
|
167
|
+
Do test connections for the inputs, then check and record the results for the **OR** and **AND** outputs.
|
|
168
168
|
|
|
169
169
|
#### OR truth table
|
|
170
170
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
A basic aspect of knowledge and understanding is whether something is true or not. Considering conditions around you and making a conclusion about something being true or false means that you are using logic. Computers and, in fact, all of digital electronics rely on this idea of logic to process information and give results in terms of conditions being true or false. Logic is used almost everywhere in the programs you write in places where you want decide to do one task or another.
|
|
5
|
+
A basic aspect of knowledge and understanding is whether something is true or not. Considering conditions around you and making a conclusion about something being true or false means that you are using logic. Computers and, in fact, all of digital electronics rely on this idea of logic to process information and give results in terms of conditions being either true or false. Logic is used almost everywhere in the programs you write in the places where you want decide to do one task or another.
|
|
6
6
|
|
|
7
7
|
## Logic topics
|
|
8
8
|
|
|
@@ -13,3 +13,9 @@ These topic sections teach you about applying logic to conditions and using Bool
|
|
|
13
13
|
* [Logic Explorer](/courses/logic-lab/explorer)
|
|
14
14
|
* [Logic Gates](/courses/logic-lab/logic-gates)
|
|
15
15
|
* [Programmable Logic](/courses/logic-lab/programmable)
|
|
16
|
+
|
|
17
|
+
## ~button /courses/logic-lab/expressions
|
|
18
|
+
|
|
19
|
+
Let's get started!
|
|
20
|
+
|
|
21
|
+
## ~
|
|
@@ -60,6 +60,6 @@ control.inBackground(function () {
|
|
|
60
60
|
music.beginMelody(music.builtInMelody(Melodies.Entertainer), MelodyOptions.Once)
|
|
61
61
|
})
|
|
62
62
|
music.onEvent(MusicEvent.BackgroundMelodyStarted, function () {
|
|
63
|
-
basic.showIcon(IconNames.
|
|
63
|
+
basic.showIcon(IconNames.EighthNote)
|
|
64
64
|
})
|
|
65
65
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pxt-microbit",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.27",
|
|
4
4
|
"description": "micro:bit target for Microsoft MakeCode (PXT)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"JavaScript",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"typescript": "4.2.3"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"pxt-common-packages": "10.4.
|
|
49
|
-
"pxt-core": "8.6.
|
|
48
|
+
"pxt-common-packages": "10.4.9",
|
|
49
|
+
"pxt-core": "8.6.34"
|
|
50
50
|
}
|
|
51
51
|
}
|
package/pxtarget.json
CHANGED
|
@@ -418,8 +418,6 @@
|
|
|
418
418
|
"debugExtensionCode",
|
|
419
419
|
"bluetoothUartConsole",
|
|
420
420
|
"bluetoothPartialFlashing",
|
|
421
|
-
"simScreenshot",
|
|
422
|
-
"simGif",
|
|
423
421
|
"identity",
|
|
424
422
|
"blocksErrorList"
|
|
425
423
|
],
|
|
@@ -448,68 +446,6 @@
|
|
|
448
446
|
],
|
|
449
447
|
"hasReferenceDocs": true,
|
|
450
448
|
"usbDocs": "/device/usb",
|
|
451
|
-
"usbHelp": [
|
|
452
|
-
{
|
|
453
|
-
"name": "connection",
|
|
454
|
-
"os": "*",
|
|
455
|
-
"browser": "*",
|
|
456
|
-
"path": "/static/mb/device/usb-generic.jpg"
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
"name": "connection",
|
|
460
|
-
"os": "mac",
|
|
461
|
-
"browser": "*",
|
|
462
|
-
"path": "/static/mb/device/usb-mac.jpg"
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
"name": "save",
|
|
466
|
-
"os": "windows",
|
|
467
|
-
"browser": "firefox",
|
|
468
|
-
"path": "/static/mb/device/usb-windows-firefox-1.png"
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
"name": "save",
|
|
472
|
-
"os": "mac",
|
|
473
|
-
"browser": "firefox",
|
|
474
|
-
"path": "/static/mb/device/usb-osx-firefox-1.jpg"
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
"name": "save",
|
|
478
|
-
"os": "mac",
|
|
479
|
-
"browser": "chrome",
|
|
480
|
-
"path": "/static/mb/device/usb-osx-chrome.png"
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
"name": "save",
|
|
484
|
-
"os": "windows",
|
|
485
|
-
"browser": "edge",
|
|
486
|
-
"path": "/static/mb/device/usb-windows-edge-1.png"
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
"name": "save",
|
|
490
|
-
"os": "windows",
|
|
491
|
-
"browser": "ie",
|
|
492
|
-
"path": "/static/mb/device/usb-windows-ie11-1.png"
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
"name": "save",
|
|
496
|
-
"os": "windows",
|
|
497
|
-
"browser": "chrome",
|
|
498
|
-
"path": "/static/mb/device/usb-windows-chrome.png"
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
"name": "copy",
|
|
502
|
-
"os": "mac",
|
|
503
|
-
"browser": "*",
|
|
504
|
-
"path": "/static/mb/device/usb-osx-dnd.png"
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
"name": "copy",
|
|
508
|
-
"os": "windows",
|
|
509
|
-
"browser": "*",
|
|
510
|
-
"path": "/static/mb/device/usb-windows-sendto.jpg"
|
|
511
|
-
}
|
|
512
|
-
],
|
|
513
449
|
"hideHomeDetailsVideo": true,
|
|
514
450
|
"invertedMenu": true,
|
|
515
451
|
"coloredToolbox": true,
|
|
@@ -600,7 +536,9 @@
|
|
|
600
536
|
"debugger": true,
|
|
601
537
|
"simGifTransparent": "rgba(0,0,0,0)",
|
|
602
538
|
"simGifMaxFrames": 44,
|
|
539
|
+
"simScreenshot": true,
|
|
603
540
|
"simScreenshotMaxUriLength": 300000,
|
|
541
|
+
"simGif": true,
|
|
604
542
|
"qrCode": true,
|
|
605
543
|
"importExtensionFiles": true,
|
|
606
544
|
"nameProjectFirst": true,
|