pxt-microbit 8.1.1 → 8.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/block-tests.js +1 -1
- package/built/target-strings.json +1 -1
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.js +1 -1
- package/built/targetlight.json +1 -1
- package/built/theme.json +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/docs/courses.md +0 -13
- package/docs/extensions/extension-gallery.md +8 -0
- package/docs/hero-banner.md +6 -0
- package/docs/microbit-org/createai.md +41 -0
- package/docs/microbit-org/data-logging.md +49 -0
- package/docs/microbit-org/feature-videos.md +71 -0
- package/docs/microbit-org/first-lessons.md +65 -0
- package/docs/microbit-org/make-it-code-it.md +57 -0
- package/docs/microbit-org/professional-development.md +65 -0
- package/docs/projects/SUMMARY.md +69 -28
- package/docs/projects.md +43 -7
- package/docs/reference/math/constant.md +131 -0
- package/package.json +1 -1
- package/pxtarget.json +1 -3
- package/targetconfig.json +11 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Constant
|
|
2
|
+
|
|
3
|
+
A common mathematical constant value.
|
|
4
|
+
|
|
5
|
+
```sig
|
|
6
|
+
Math._constant(Math.PI)
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
There are several constant values that are important in calculations for science and engineering. The ``||math.constant||`` block provides several that you can use in your mathematical formulas and expressions.
|
|
10
|
+
|
|
11
|
+
## π
|
|
12
|
+
|
|
13
|
+
The value of Pi (π) which is the ratio of a circle's circumference to its diameter.
|
|
14
|
+
|
|
15
|
+
```block
|
|
16
|
+
Math._constant(Math.PI)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Example
|
|
20
|
+
|
|
21
|
+
Get the area of a circle with a radius of `4`.
|
|
22
|
+
|
|
23
|
+
```block
|
|
24
|
+
let circle_area = Math.PI * 4**2
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## e
|
|
28
|
+
|
|
29
|
+
Euler's number (e) which is the base of the natural logarithm and the exponential function.
|
|
30
|
+
|
|
31
|
+
```block
|
|
32
|
+
Math._constant(Math.E)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Example
|
|
36
|
+
|
|
37
|
+
Find the half-life, in years, of radioactive decay for Carbon-14.
|
|
38
|
+
|
|
39
|
+
```block
|
|
40
|
+
let time = 0
|
|
41
|
+
let decay = 0.000121
|
|
42
|
+
let carbon14 = 1
|
|
43
|
+
while (carbon14 > 0.5) {
|
|
44
|
+
carbon14 = Math.E ** (-1 * decay * time)
|
|
45
|
+
time += 1
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## ln(2)
|
|
50
|
+
|
|
51
|
+
Natural log of 2.
|
|
52
|
+
|
|
53
|
+
```block
|
|
54
|
+
Math._constant(Math.LN2)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Example
|
|
58
|
+
|
|
59
|
+
Find out how many years will it take to double an investment using continuous compounding at 5% interest.
|
|
60
|
+
|
|
61
|
+
```block
|
|
62
|
+
let years = Math.LN2 / 0.05
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## ln(10)
|
|
66
|
+
|
|
67
|
+
Natural log of 10.
|
|
68
|
+
|
|
69
|
+
```block
|
|
70
|
+
Math._constant(Math.LN10)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Example
|
|
74
|
+
|
|
75
|
+
How many days will it take for bacteria in a culture to reach 10 times the start amount if they double in number each day.
|
|
76
|
+
|
|
77
|
+
```block
|
|
78
|
+
let days = Math.LN10
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## log₂(e)
|
|
82
|
+
|
|
83
|
+
Convert from a natural logarithm to a base-2 logarithm.
|
|
84
|
+
|
|
85
|
+
```block
|
|
86
|
+
Math._constant(Math.LOG2E)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The log₂(e) constant is equal to ln(e) / ln(2) which is also 1 / ln(2).
|
|
90
|
+
|
|
91
|
+
## log₁₀(e)
|
|
92
|
+
|
|
93
|
+
Convert from a natural logarithm to a base-10 logarithm.
|
|
94
|
+
|
|
95
|
+
```block
|
|
96
|
+
Math._constant(Math.LOG10E)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The log₁₀(e) constant is equal to 1 / ln(10) which is also 1 / ln(10).
|
|
100
|
+
|
|
101
|
+
## √½
|
|
102
|
+
|
|
103
|
+
The square root of one half (1/2).
|
|
104
|
+
|
|
105
|
+
```block
|
|
106
|
+
Math._constant(Math.SQRT1_2)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Example
|
|
110
|
+
|
|
111
|
+
Find the length of the sides of a square with a diagonal length of 9.
|
|
112
|
+
|
|
113
|
+
```block
|
|
114
|
+
let side = 9 * Math.SQRT1_2
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## √2
|
|
118
|
+
|
|
119
|
+
The square root of 2.
|
|
120
|
+
|
|
121
|
+
```block
|
|
122
|
+
Math._constant(Math.SQRT2)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Example
|
|
126
|
+
|
|
127
|
+
Find out how much shorter it is by walking across a square parking lot on a street corner than using the sidewalk on the sides. Each side of the parking lot is 50 meters.
|
|
128
|
+
|
|
129
|
+
```block
|
|
130
|
+
let walk_diff = 2 * 50 - 50 * Math.SQRT2
|
|
131
|
+
```
|
package/package.json
CHANGED
package/pxtarget.json
CHANGED
package/targetconfig.json
CHANGED
|
@@ -429,7 +429,9 @@
|
|
|
429
429
|
"forward-education/pxt-climate-action": { "tags": [ "Science" ] },
|
|
430
430
|
"elecfreaks/pxt-petal": { "tags": [ "Science" ] },
|
|
431
431
|
"kitronikltd/pxt-kitronik-mai-z": { "tags": [ "Robotics" ] },
|
|
432
|
+
"smarthon/pxt-smarthome": { "tags": [ "Networking" ] },
|
|
432
433
|
"roborisen/braillebot": { "tags": [ "Robotics" ] },
|
|
434
|
+
"backyardbrains/pxt-spikerbit": { "tags": [ "Science" ] },
|
|
433
435
|
"microsoft/pxt-simx-sample": {
|
|
434
436
|
"simx": {
|
|
435
437
|
"sha": "7301f5900879b85127482d79bab48f03c25690a8",
|
|
@@ -446,7 +448,7 @@
|
|
|
446
448
|
},
|
|
447
449
|
"jacdac/pxt-jacdac": {
|
|
448
450
|
"simx": {
|
|
449
|
-
"sha": "
|
|
451
|
+
"sha": "1804c0b3d2976935c476f3b6d425b554a20fa814",
|
|
450
452
|
"devUrl": "https://jacdac.github.io/jacdac-docs/tools/makecode-sim/"
|
|
451
453
|
}
|
|
452
454
|
},
|
|
@@ -467,13 +469,15 @@
|
|
|
467
469
|
"galleries": {
|
|
468
470
|
"Tutorials": "tutorials",
|
|
469
471
|
"Tutorials for the new micro:bit (V2)": "tutorials-v2",
|
|
472
|
+
"Games": "projects/games",
|
|
473
|
+
"Make it: code it Examples": "microbit-org/make-it-code-it",
|
|
474
|
+
"Radio Games": "projects/radio-games",
|
|
475
|
+
"Data Logging Examples": "microbit-org/data-logging",
|
|
470
476
|
"Live Coding": {
|
|
471
477
|
"url": "live-coding",
|
|
472
478
|
"shuffle": "daily",
|
|
473
479
|
"youTube": true
|
|
474
480
|
},
|
|
475
|
-
"Games": "projects/games",
|
|
476
|
-
"Radio Games": "projects/radio-games",
|
|
477
481
|
"Fashion": "projects/fashion",
|
|
478
482
|
"Music": "projects/music",
|
|
479
483
|
"Toys": "projects/toys",
|
|
@@ -481,9 +485,12 @@
|
|
|
481
485
|
"Tools": "projects/tools",
|
|
482
486
|
"Turtle": "projects/turtle",
|
|
483
487
|
"Blocks to JavaScript": "courses/blocks-to-javascript",
|
|
488
|
+
"First Lessons with MakeCode and the micro:bit": "microbit-org/first-lessons",
|
|
489
|
+
"CreateAI": "microbit-org/createai",
|
|
484
490
|
"Courses": "courses",
|
|
485
491
|
"Jacdac": "jacdac",
|
|
486
492
|
"MicroCode for the new micro:bit (V2)": "microcode",
|
|
493
|
+
"Introductory micro:bit Feature Videos": "microbit-org/feature-videos",
|
|
487
494
|
"Behind the MakeCode Hardware": {
|
|
488
495
|
"url": "behind-the-makecode-hardware",
|
|
489
496
|
"youTube": true
|
|
@@ -492,6 +499,7 @@
|
|
|
492
499
|
"url": "science-experiments",
|
|
493
500
|
"youTube": true
|
|
494
501
|
},
|
|
502
|
+
"Educator Professional Development": "microbit-org/professional-development",
|
|
495
503
|
"Coding for Teachers": {
|
|
496
504
|
"url": "coding-for-teachers",
|
|
497
505
|
"youTube": true
|