Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24420a2cc4 | ||
|
|
2f8b61998b | ||
|
|
af38071c6a | ||
|
|
89f09c7f35 | ||
|
|
a667467bbd | ||
|
|
ada2583e17 | ||
|
|
c04538313d | ||
|
|
1039dc560e | ||
|
|
957c7ad848 | ||
|
|
5e7351a481 | ||
|
|
f0c089373b | ||
|
|
879a85bdbb | ||
|
|
7a9c2e0fe4 | ||
|
|
9656c1159a | ||
|
|
801117d6b0 | ||
|
|
c084bff334 | ||
|
|
18bf35f179 | ||
|
|
7e7dc91947 | ||
|
|
da79f643dc | ||
|
|
ea10cde3eb |
171
docs/camp.md
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
# Getting started
|
||||||
|
|
||||||
|
Are you ready to build cool BBC micro:bit programs? For each challenge, reorder the blocks to recreate the program.
|
||||||
|
|
||||||
|
* If you haven't done so, open [https://m.pxt.io](/) and create a new **Blocks Editor** project
|
||||||
|
|
||||||
|
## Basic
|
||||||
|
|
||||||
|
### Show leds
|
||||||
|
|
||||||
|
Use the blocks below to draw a figure on the screen. You can redo the smiley face or try something else!
|
||||||
|
|
||||||
|
```shuffle
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
```
|
||||||
|
|
||||||
|
To transfer your code to the BBC micro:bit,
|
||||||
|
* connect your micro:bit to the computer using the USB cable
|
||||||
|
* click on **Download**
|
||||||
|
* drag&drop the **.hex** file into the **MICROBIT** drive
|
||||||
|
* wait till the yellow light is done blinking!
|
||||||
|
|
||||||
|
### Show animation Forever
|
||||||
|
|
||||||
|
Show one image after the other to create an animation.,
|
||||||
|
|
||||||
|
Reorder the blocks to make the micro:bit show a happy, then unhappy face.
|
||||||
|
```shuffle
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
. # # # .
|
||||||
|
# . . . #
|
||||||
|
`)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Repeat forever
|
||||||
|
|
||||||
|
Use the ``forever`` block to repeat your code and have a continuous animation.
|
||||||
|
|
||||||
|
Unsuffle the blocks to create a happy, unhappy animation.... or changes the image to make it your own!
|
||||||
|
```shuffle
|
||||||
|
basic.forever(() => {
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
. # # # .
|
||||||
|
# . . . #
|
||||||
|
`)
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Your turn now!
|
||||||
|
|
||||||
|
Use the blocks ``show leds`` and ``forever``
|
||||||
|
to create your own custom awesome animation!
|
||||||
|
|
||||||
|
## Inputs
|
||||||
|
|
||||||
|
### Button A and B
|
||||||
|
|
||||||
|
Unshuffle the blocks so that the micro:bit shows "YES" when button A is pressed, and "NO" when B is pressed.
|
||||||
|
The key idea is that all the blocks nested under `on button ... pressed` will run when that button is pressed.
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
input.onButtonPressed(Button.A, () => {
|
||||||
|
basic.showString("AAAAA");
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Try to unshuffle those blocks:
|
||||||
|
```shuffle
|
||||||
|
input.onButtonPressed(Button.A, () => {
|
||||||
|
basic.showString("YES");
|
||||||
|
});
|
||||||
|
input.onButtonPressed(Button.B, () => {
|
||||||
|
basic.showString("NO");
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shake
|
||||||
|
|
||||||
|
Using the data from the **accelerometer**, it is possible to detect that the BBC micro:bit is being shaken.
|
||||||
|
|
||||||
|
Unshuffle the code to display a frownie when shaken.
|
||||||
|
```shuffle
|
||||||
|
input.onGesture(Gesture.Shake, () => {
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
. # # # .
|
||||||
|
# . . . #`);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tilting
|
||||||
|
|
||||||
|
Aside from shake, it is also possible to detect tilt left and right, logo up and down or face up and down.
|
||||||
|
Let's build a rock paper scissors game where you turn the micro:bit left to display paper, right to display scissors and down to display rock.
|
||||||
|
|
||||||
|
Unshuffle and try this code on the micro:bit itself!
|
||||||
|
```shuffle
|
||||||
|
input.onGesture(Gesture.TiltLeft, () => {
|
||||||
|
basic.showLeds(`
|
||||||
|
# # # # #
|
||||||
|
# . . . #
|
||||||
|
# . . . #
|
||||||
|
# . . . #
|
||||||
|
# # # # #`);
|
||||||
|
});
|
||||||
|
input.onGesture(Gesture.LogoDown, () => {
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # # # .
|
||||||
|
. # # # .
|
||||||
|
. # # # .
|
||||||
|
. . . . .`);
|
||||||
|
});
|
||||||
|
input.onGesture(Gesture.TiltRight, () => {
|
||||||
|
basic.showLeds(`
|
||||||
|
# # . . #
|
||||||
|
# # . # .
|
||||||
|
. . # . .
|
||||||
|
# # . # .
|
||||||
|
# # . . #`);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pins
|
||||||
|
|
||||||
|
It is possible to use the pins (big metal bar at the bottom of the board) as button. Hold the ``GND`` button with one hand and press the ``0`` pin
|
||||||
|
(called ``P0``) with the other hand to trigger a pin pressed.
|
||||||
|
|
||||||
|
Unshuffle the blocks to display a smiley when pin ``P0`` is pressed.
|
||||||
|
```shuffle
|
||||||
|
input.onPinPressed(TouchPin.P0, () => {
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .`);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Your turn now!
|
||||||
|
|
||||||
|
Use the scree, buttons, gestures, pins to create a fun game using the micro:bit.
|
||||||
BIN
docs/static/favicon.png
vendored
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
docs/static/icons/android-chrome-144x144.png
vendored
Normal file
|
After Width: | Height: | Size: 1011 B |
BIN
docs/static/icons/android-chrome-192x192.png
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
docs/static/icons/android-chrome-36x36.png
vendored
Normal file
|
After Width: | Height: | Size: 352 B |
BIN
docs/static/icons/android-chrome-48x48.png
vendored
Normal file
|
After Width: | Height: | Size: 450 B |
BIN
docs/static/icons/android-chrome-72x72.png
vendored
Normal file
|
After Width: | Height: | Size: 565 B |
BIN
docs/static/icons/android-chrome-96x96.png
vendored
Normal file
|
After Width: | Height: | Size: 724 B |
BIN
docs/static/icons/apple-touch-icon-114x114.png
vendored
Normal file
|
After Width: | Height: | Size: 757 B |
BIN
docs/static/icons/apple-touch-icon-120x120.png
vendored
Normal file
|
After Width: | Height: | Size: 752 B |
BIN
docs/static/icons/apple-touch-icon-144x144.png
vendored
Normal file
|
After Width: | Height: | Size: 917 B |
BIN
docs/static/icons/apple-touch-icon-152x152.png
vendored
Normal file
|
After Width: | Height: | Size: 958 B |
BIN
docs/static/icons/apple-touch-icon-180x180.png
vendored
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
docs/static/icons/apple-touch-icon-57x57.png
vendored
Normal file
|
After Width: | Height: | Size: 429 B |
BIN
docs/static/icons/apple-touch-icon-60x60.png
vendored
Normal file
|
After Width: | Height: | Size: 480 B |
BIN
docs/static/icons/apple-touch-icon-72x72.png
vendored
Normal file
|
After Width: | Height: | Size: 543 B |
BIN
docs/static/icons/apple-touch-icon-76x76.png
vendored
Normal file
|
After Width: | Height: | Size: 557 B |
BIN
docs/static/icons/apple-touch-icon-precomposed.png
vendored
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
docs/static/icons/apple-touch-icon.png
vendored
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
docs/static/icons/favicon-16x16.png
vendored
Normal file
|
After Width: | Height: | Size: 274 B |
BIN
docs/static/icons/favicon-32x32.png
vendored
Normal file
|
After Width: | Height: | Size: 382 B |
BIN
docs/static/icons/favicon-96x96.png
vendored
Normal file
|
After Width: | Height: | Size: 724 B |
BIN
docs/static/icons/mstile-144x144.png
vendored
Normal file
|
After Width: | Height: | Size: 1011 B |
BIN
docs/static/icons/mstile-150x150.png
vendored
Normal file
|
After Width: | Height: | Size: 918 B |
BIN
docs/static/icons/mstile-310x150.png
vendored
Normal file
|
After Width: | Height: | Size: 971 B |
BIN
docs/static/icons/mstile-310x310.png
vendored
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
docs/static/icons/mstile-70x70.png
vendored
Normal file
|
After Width: | Height: | Size: 682 B |
59
docs/static/icons/safari-pinned-tab.svg
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||||
|
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||||
|
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="319.000000pt" height="319.000000pt" viewBox="0 0 319.000000 319.000000"
|
||||||
|
preserveAspectRatio="xMidYMid meet">
|
||||||
|
<metadata>
|
||||||
|
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
||||||
|
</metadata>
|
||||||
|
<g transform="translate(0.000000,319.000000) scale(0.100000,-0.100000)"
|
||||||
|
fill="#000000" stroke="none">
|
||||||
|
<path d="M145 2888 c-49 -17 -92 -55 -114 -101 -21 -43 -21 -46 -21 -1110 l0
|
||||||
|
-1067 40 0 40 0 0 -135 c0 -78 4 -135 9 -135 6 0 11 90 13 218 3 207 4 218 26
|
||||||
|
249 28 40 98 68 147 59 46 -9 102 -59 112 -99 5 -18 7 -127 5 -244 l-3 -212
|
||||||
|
-107 -4 -107 -3 120 0 120 1 3 158 3 158 142 -3 142 -3 3 -157 c1 -87 7 -158
|
||||||
|
12 -158 5 0 10 100 12 227 3 254 8 274 78 320 60 41 143 20 187 -46 22 -33 23
|
||||||
|
-41 23 -267 0 -149 4 -234 10 -234 6 0 10 60 10 160 l0 160 190 0 190 0 0
|
||||||
|
-161 c0 -104 3 -158 10 -154 6 4 10 93 10 233 0 207 2 230 20 259 40 67 112
|
||||||
|
88 182 54 78 -38 83 -53 86 -319 2 -135 7 -232 13 -232 5 0 9 68 9 160 l0 160
|
||||||
|
185 0 185 0 0 -154 c0 -93 4 -157 10 -161 7 -4 10 66 10 202 0 114 5 225 10
|
||||||
|
245 34 121 169 154 249 63 l31 -36 0 -234 c0 -145 4 -236 10 -240 7 -4 10 50
|
||||||
|
10 154 l0 161 150 0 150 0 0 -160 c0 -100 4 -160 10 -160 6 0 10 83 10 228 0
|
||||||
|
263 4 280 81 320 51 27 104 24 151 -9 54 -39 58 -58 58 -294 0 -137 4 -215 10
|
||||||
|
-215 6 0 10 53 10 140 l0 140 45 0 44 0 4 -77 c1 -43 4 435 5 1062 1 1092 1
|
||||||
|
1142 -17 1180 -24 53 -55 83 -105 106 -39 18 -96 19 -1466 18 -967 0 -1435 -4
|
||||||
|
-1455 -11z m1203 -635 l3 -73 -41 0 -40 0 0 76 0 75 38 -3 37 -3 3 -72z m587
|
||||||
|
2 l0 -70 -37 -3 -38 -3 0 76 0 76 38 -3 37 -3 0 -70z m-880 -280 l0 -70 -40 0
|
||||||
|
-40 0 -3 49 c-2 27 -1 60 3 73 5 21 11 24 43 21 l37 -3 0 -70z m589 59 c9 -23
|
||||||
|
7 -107 -3 -122 -5 -8 -22 -12 -42 -10 l-34 3 -3 59 c-2 32 -1 65 2 72 8 20 72
|
||||||
|
18 80 -2z m584 -61 l3 -73 -41 0 -40 0 0 68 c0 38 3 72 7 76 4 4 21 6 38 4
|
||||||
|
l30 -3 3 -72z m-880 -5 l-3 -73 -35 0 -35 0 -3 73 -3 72 41 0 41 0 -3 -72z
|
||||||
|
m570 -5 l3 -73 -41 0 -40 0 0 68 c0 38 3 72 7 76 4 4 21 6 38 4 l30 -3 3 -72z
|
||||||
|
m-1388 -363 l0 -180 -185 0 -185 0 0 180 0 180 185 0 185 0 0 -180z m2500 0
|
||||||
|
l0 -180 -180 0 -180 0 0 180 0 180 180 0 180 0 0 -180z m-1982 161 c9 -5 12
|
||||||
|
-27 10 -72 l-3 -64 -40 0 -40 0 -3 58 c-2 35 2 64 9 73 13 15 47 18 67 5z
|
||||||
|
m307 -66 l0 -70 -37 -3 -38 -3 0 76 0 76 38 -3 37 -3 0 -70z m873 -2 l3 -73
|
||||||
|
-41 0 -40 0 0 68 c0 38 3 72 7 76 4 4 21 6 38 4 l30 -3 3 -72z m-590 -10 l3
|
||||||
|
-73 -41 0 -40 0 0 68 c0 38 3 72 7 76 4 4 21 6 38 4 l30 -3 3 -72z m280 68 c9
|
||||||
|
-5 12 -27 10 -72 l-3 -64 -40 0 -40 0 -3 64 c-3 67 4 81 43 81 11 0 26 -4 33
|
||||||
|
-9z m-568 -341 l0 -70 -40 0 -40 0 0 70 0 70 40 0 40 0 0 -70z m590 0 l0 -70
|
||||||
|
-40 0 -40 0 0 70 0 70 40 0 40 0 0 -70z m-292 -27 l3 -73 -41 0 -40 0 0 68 c0
|
||||||
|
38 3 72 7 76 4 4 21 6 38 4 l30 -3 3 -72z m-3 -253 l0 -65 -42 -3 -43 -3 0 71
|
||||||
|
0 71 43 -3 42 -3 0 -65z"/>
|
||||||
|
<path d="M294 1689 c-25 -13 -54 -60 -54 -89 0 -55 47 -100 105 -100 42 0 75
|
||||||
|
20 94 57 15 29 14 49 -4 88 -24 49 -88 69 -141 44z"/>
|
||||||
|
<path d="M2779 1671 c-23 -23 -29 -38 -29 -71 0 -91 106 -135 171 -71 64 65
|
||||||
|
20 171 -71 171 -33 0 -48 -6 -71 -29z"/>
|
||||||
|
<path d="M845 836 c-88 -40 -106 -150 -34 -210 24 -20 41 -26 81 -26 44 0 54
|
||||||
|
4 84 34 32 32 40 56 34 111 -7 70 -99 121 -165 91z"/>
|
||||||
|
<path d="M1543 836 c-89 -40 -97 -178 -13 -221 66 -34 141 -10 175 55 19 37
|
||||||
|
19 64 -1 105 -28 60 -101 87 -161 61z"/>
|
||||||
|
<path d="M2255 836 c-86 -38 -105 -146 -35 -208 24 -23 40 -28 79 -28 143 0
|
||||||
|
173 188 38 239 -36 14 -45 13 -82 -3z"/>
|
||||||
|
<path d="M192 820 c-118 -72 -38 -255 98 -225 45 10 90 67 90 116 0 105 -99
|
||||||
|
163 -188 109z"/>
|
||||||
|
<path d="M2875 831 c-90 -40 -97 -169 -12 -221 122 -75 250 92 149 193 -32 31
|
||||||
|
-98 45 -137 28z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.6 KiB |
@@ -141,7 +141,7 @@ namespace control {
|
|||||||
* @param value Component specific code indicating the cause of the event.
|
* @param value Component specific code indicating the cause of the event.
|
||||||
* @param mode optional definition of how the event should be processed after construction (default is CREATE_AND_FIRE).
|
* @param mode optional definition of how the event should be processed after construction (default is CREATE_AND_FIRE).
|
||||||
*/
|
*/
|
||||||
//% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source|with value %value=control_event_value" blockExternalInputs=1
|
//% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source_id|with value %value=control_event_value_id" blockExternalInputs=1
|
||||||
//% mode.defl=CREATE_AND_FIRE
|
//% mode.defl=CREATE_AND_FIRE
|
||||||
void raiseEvent(int src, int value, EventCreationMode mode) {
|
void raiseEvent(int src, int value, EventCreationMode mode) {
|
||||||
MicroBitEvent evt(src, value, (MicroBitEventLaunchMode)mode);
|
MicroBitEvent evt(src, value, (MicroBitEventLaunchMode)mode);
|
||||||
@@ -150,12 +150,30 @@ namespace control {
|
|||||||
/**
|
/**
|
||||||
* Raises an event in the event bus.
|
* Raises an event in the event bus.
|
||||||
*/
|
*/
|
||||||
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source|with value %value=control_event_value"
|
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source_id|with value %value=control_event_value_id"
|
||||||
//% blockExternalInputs=1
|
//% blockExternalInputs=1
|
||||||
void onEvent(int src, int value, Action handler) {
|
void onEvent(int src, int value, Action handler) {
|
||||||
registerWithDal(src, value, handler);
|
registerWithDal(src, value, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the last event executed on the bus
|
||||||
|
*/
|
||||||
|
//% blockId=control_event_value" block="event value"
|
||||||
|
//% weight=18
|
||||||
|
int eventValue() {
|
||||||
|
return pxt::lastEvent.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the timestamp of the last event executed on the bus
|
||||||
|
*/
|
||||||
|
//% blockId=control_event_timestamp" block="event timestamp"
|
||||||
|
//% weight=19 blockGap-8
|
||||||
|
int eventTimestamp() {
|
||||||
|
return pxt::lastEvent.timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a friendly name for the device derived from the its serial number
|
* Gets a friendly name for the device derived from the its serial number
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ namespace control {
|
|||||||
/**
|
/**
|
||||||
* Returns the value of a C++ runtime constant
|
* Returns the value of a C++ runtime constant
|
||||||
*/
|
*/
|
||||||
//% weight=19 weight=19 blockId="control_event_source" block="%id"
|
//% weight=2 weight=19 blockId="control_event_source_id" block="%id" blockGap=8
|
||||||
export function eventSource(id: EventBusSource) : number {
|
export function eventSourceId(id: EventBusSource): number {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the value of a C++ runtime constant
|
* Returns the value of a C++ runtime constant
|
||||||
*/
|
*/
|
||||||
//% weight=19 weight=19 blockId="control_event_value" block="%id"
|
//% weight=1 weight=19 blockId="control_event_value_id" block="%id"
|
||||||
export function eventValue(id: EventBusValue) : number {
|
export function eventValueId(id: EventBusValue): number {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,8 +23,7 @@ namespace control {
|
|||||||
* Display specified error code and stop the program.
|
* Display specified error code and stop the program.
|
||||||
*/
|
*/
|
||||||
//% shim=pxtrt::panic
|
//% shim=pxtrt::panic
|
||||||
export function panic(code:number)
|
export function panic(code: number) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
6
libs/microbit/enums.d.ts
vendored
@@ -262,6 +262,12 @@ declare namespace led {
|
|||||||
P4 = 11, // MICROBIT_ID_IO_P4
|
P4 = 11, // MICROBIT_ID_IO_P4
|
||||||
P10 = 17, // MICROBIT_ID_IO_P10
|
P10 = 17, // MICROBIT_ID_IO_P10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare enum PulseValue {
|
||||||
|
High = 4, // MICROBIT_PIN_EVT_PULSE_HI
|
||||||
|
Low = 5, // MICROBIT_PIN_EVT_PULSE_LO
|
||||||
|
}
|
||||||
declare namespace pins {
|
declare namespace pins {
|
||||||
}
|
}
|
||||||
declare namespace serial {
|
declare namespace serial {
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace input {
|
|||||||
* @param button TODO
|
* @param button TODO
|
||||||
* @param body TODO
|
* @param body TODO
|
||||||
*/
|
*/
|
||||||
//% help=input/on-button-pressed weight=85
|
//% help=input/on-button-pressed weight=85 blockGap=8
|
||||||
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192"
|
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192"
|
||||||
void onButtonPressed(Button button, Action body) {
|
void onButtonPressed(Button button, Action body) {
|
||||||
registerWithDal((int)button, MICROBIT_BUTTON_EVT_CLICK, body);
|
registerWithDal((int)button, MICROBIT_BUTTON_EVT_CLICK, body);
|
||||||
@@ -114,7 +114,7 @@ namespace input {
|
|||||||
* Attaches code to run when the screen is facing up.
|
* Attaches code to run when the screen is facing up.
|
||||||
* @param body TODO
|
* @param body TODO
|
||||||
*/
|
*/
|
||||||
//% help=input/on-gesture weight=84
|
//% help=input/on-gesture weight=84 blockGap=8
|
||||||
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135"
|
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135"
|
||||||
void onGesture(Gesture gesture, Action body) {
|
void onGesture(Gesture gesture, Action body) {
|
||||||
registerWithDal(MICROBIT_ID_GESTURE, (int)gesture, body);
|
registerWithDal(MICROBIT_ID_GESTURE, (int)gesture, body);
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ namespace led {
|
|||||||
|
|
||||||
let v = (value * 15) / barGraphHigh;
|
let v = (value * 15) / barGraphHigh;
|
||||||
let k = 0;
|
let k = 0;
|
||||||
for(let y = 4; y >= 0; --y) {
|
for (let y = 4; y >= 0; --y) {
|
||||||
for (let x = 0; x < 3; ++x) {
|
for (let x = 0; x < 3; ++x) {
|
||||||
if (k > v) {
|
if (k > v) {
|
||||||
unplot(2-x,y);
|
unplot(2 - x, y);
|
||||||
unplot(2+x,y);
|
unplot(2 + x, y);
|
||||||
} else {
|
} else {
|
||||||
plot(2-x, y);
|
plot(2 - x, y);
|
||||||
plot(2+x, y);
|
plot(2 + x, y);
|
||||||
}
|
}
|
||||||
++k;
|
++k;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ enum BeatFraction {
|
|||||||
/**
|
/**
|
||||||
* Generation of music tones through pin ``P0``.
|
* Generation of music tones through pin ``P0``.
|
||||||
*/
|
*/
|
||||||
//% color=52 weight=33
|
//% color=52 weight=98
|
||||||
namespace music {
|
namespace music {
|
||||||
var beatsPerMinute: number = 120;
|
let beatsPerMinute: number = 120;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays a tone through pin ``P0`` for the given duration.
|
* Plays a tone through pin ``P0`` for the given duration.
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ enum class AnalogPin {
|
|||||||
P10 = MICROBIT_ID_IO_P10,
|
P10 = MICROBIT_ID_IO_P10,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class PulseValue {
|
||||||
|
High = MICROBIT_PIN_EVT_PULSE_HI,
|
||||||
|
Low = MICROBIT_PIN_EVT_PULSE_LO
|
||||||
|
};
|
||||||
|
|
||||||
MicroBitPin *getPin(int id) {
|
MicroBitPin *getPin(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case MICROBIT_ID_IO_P0: return &uBit.io.P0;
|
case MICROBIT_ID_IO_P0: return &uBit.io.P0;
|
||||||
@@ -75,7 +80,6 @@ namespace pins {
|
|||||||
return getPin(id);
|
return getPin(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the specified pin or connector as either 0 or 1
|
* Read the specified pin or connector as either 0 or 1
|
||||||
* @param name pin to read from
|
* @param name pin to read from
|
||||||
@@ -130,6 +134,29 @@ namespace pins {
|
|||||||
PINOP(setAnalogPeriodUs(micros));
|
PINOP(setAnalogPeriodUs(micros));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.
|
||||||
|
*/
|
||||||
|
//% help=pins/on-pulsed weight=22 blockGap=8
|
||||||
|
//% blockId=pins_on_pulsed block="on|pin %pin|pulsed %pulse"
|
||||||
|
void onPulsed(DigitalPin name, PulseValue pulse, Action body) {
|
||||||
|
MicroBitPin* pin = getPin((int)name);
|
||||||
|
if (!pin) return;
|
||||||
|
|
||||||
|
pin->eventOn(MICROBIT_PIN_EVENT_ON_PULSE);
|
||||||
|
registerWithDal((int)name, (int)pulse, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulse`` handler.
|
||||||
|
*/
|
||||||
|
//% help=pins/pulse-micros
|
||||||
|
//% blockId=pins_pulse_duration block="pulse duration (us)"
|
||||||
|
//% weight=21
|
||||||
|
int pulseDuration() {
|
||||||
|
return pxt::lastEvent.timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
||||||
* @param name pin to write to
|
* @param name pin to write to
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace pins {
|
|||||||
* @param toLow the lower bound of the value's target range
|
* @param toLow the lower bound of the value's target range
|
||||||
* @param toHigh the upper bound of the value's target range, eg: 4
|
* @param toHigh the upper bound of the value's target range, eg: 4
|
||||||
*/
|
*/
|
||||||
//% help=pins/map weight=15
|
//% help=pins/map weight=3
|
||||||
//% blockId=math_map block="map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh"
|
//% blockId=math_map block="map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh"
|
||||||
export function map(value: number, fromLow: number, fromHigh: number, toLow: number, toHigh: number): number {
|
export function map(value: number, fromLow: number, fromHigh: number, toLow: number, toHigh: number): number {
|
||||||
return ((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) + toLow;
|
return ((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) + toLow;
|
||||||
@@ -20,6 +20,8 @@ namespace pins {
|
|||||||
/**
|
/**
|
||||||
* Read one number from 7-bit I2C address.
|
* Read one number from 7-bit I2C address.
|
||||||
*/
|
*/
|
||||||
|
//% help=pins/i2c-read-number blockGap=8
|
||||||
|
//% blockId=pins_i2c_readnumber block="i2c read number|at address %address|of format %format=i2c_sizeof" weight=7
|
||||||
export function i2cReadNumber(address: number, format: NumberFormat): number {
|
export function i2cReadNumber(address: number, format: NumberFormat): number {
|
||||||
let buf = pins.i2cReadBuffer(address, pins.sizeOf(format))
|
let buf = pins.i2cReadBuffer(address, pins.sizeOf(format))
|
||||||
return buf.getNumber(format, 0)
|
return buf.getNumber(format, 0)
|
||||||
@@ -28,6 +30,8 @@ namespace pins {
|
|||||||
/**
|
/**
|
||||||
* Write one number to a 7-bit I2C address.
|
* Write one number to a 7-bit I2C address.
|
||||||
*/
|
*/
|
||||||
|
//% help=pins/i2c-write-number
|
||||||
|
//% blockId=i2c_writenumber block="i2c write number|at address %address|with value %value|of format %format=i2c_sizeof" weight=6
|
||||||
export function i2cWriteNumber(address: number, value: number, format: NumberFormat): void {
|
export function i2cWriteNumber(address: number, value: number, format: NumberFormat): void {
|
||||||
let buf = createBuffer(pins.sizeOf(format))
|
let buf = createBuffer(pins.sizeOf(format))
|
||||||
buf.setNumber(format, 0, value)
|
buf.setNumber(format, 0, value)
|
||||||
@@ -37,6 +41,7 @@ namespace pins {
|
|||||||
/**
|
/**
|
||||||
* Get the size in bytes of specified number format.
|
* Get the size in bytes of specified number format.
|
||||||
*/
|
*/
|
||||||
|
//%
|
||||||
export function sizeOf(format: NumberFormat) {
|
export function sizeOf(format: NumberFormat) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case NumberFormat.Int8LE:
|
case NumberFormat.Int8LE:
|
||||||
|
|||||||
37
libs/microbit/shims.d.ts
vendored
@@ -200,7 +200,7 @@ declare namespace input {
|
|||||||
* @param button TODO
|
* @param button TODO
|
||||||
* @param body TODO
|
* @param body TODO
|
||||||
*/
|
*/
|
||||||
//% help=input/on-button-pressed weight=85
|
//% help=input/on-button-pressed weight=85 blockGap=8
|
||||||
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192" shim=input::onButtonPressed
|
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192" shim=input::onButtonPressed
|
||||||
function onButtonPressed(button: Button, body: () => void): void;
|
function onButtonPressed(button: Button, body: () => void): void;
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ declare namespace input {
|
|||||||
* Attaches code to run when the screen is facing up.
|
* Attaches code to run when the screen is facing up.
|
||||||
* @param body TODO
|
* @param body TODO
|
||||||
*/
|
*/
|
||||||
//% help=input/on-gesture weight=84
|
//% help=input/on-gesture weight=84 blockGap=8
|
||||||
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135" shim=input::onGesture
|
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135" shim=input::onGesture
|
||||||
function onGesture(gesture: Gesture, body: () => void): void;
|
function onGesture(gesture: Gesture, body: () => void): void;
|
||||||
|
|
||||||
@@ -332,17 +332,31 @@ declare namespace control {
|
|||||||
* @param value Component specific code indicating the cause of the event.
|
* @param value Component specific code indicating the cause of the event.
|
||||||
* @param mode optional definition of how the event should be processed after construction (default is CREATE_AND_FIRE).
|
* @param mode optional definition of how the event should be processed after construction (default is CREATE_AND_FIRE).
|
||||||
*/
|
*/
|
||||||
//% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source|with value %value=control_event_value" blockExternalInputs=1
|
//% weight=21 blockGap=12 blockId="control_raise_event" block="raise event|from source %src=control_event_source_id|with value %value=control_event_value_id" blockExternalInputs=1
|
||||||
//% mode.defl=1 shim=control::raiseEvent
|
//% mode.defl=1 shim=control::raiseEvent
|
||||||
function raiseEvent(src: number, value: number, mode?: EventCreationMode): void;
|
function raiseEvent(src: number, value: number, mode?: EventCreationMode): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raises an event in the event bus.
|
* Raises an event in the event bus.
|
||||||
*/
|
*/
|
||||||
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source|with value %value=control_event_value"
|
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source_id|with value %value=control_event_value_id"
|
||||||
//% blockExternalInputs=1 shim=control::onEvent
|
//% blockExternalInputs=1 shim=control::onEvent
|
||||||
function onEvent(src: number, value: number, handler: () => void): void;
|
function onEvent(src: number, value: number, handler: () => void): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the last event executed on the bus
|
||||||
|
*/
|
||||||
|
//% blockId=control_event_value" block="event value"
|
||||||
|
//% weight=18 shim=control::eventValue
|
||||||
|
function eventValue(): number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the timestamp of the last event executed on the bus
|
||||||
|
*/
|
||||||
|
//% blockId=control_event_timestamp" block="event timestamp"
|
||||||
|
//% weight=19 blockGap-8 shim=control::eventTimestamp
|
||||||
|
function eventTimestamp(): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a friendly name for the device derived from the its serial number
|
* Gets a friendly name for the device derived from the its serial number
|
||||||
*/
|
*/
|
||||||
@@ -473,6 +487,21 @@ declare namespace pins {
|
|||||||
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros" shim=pins::analogSetPeriod
|
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros" shim=pins::analogSetPeriod
|
||||||
function analogSetPeriod(name: AnalogPin, micros: number): void;
|
function analogSetPeriod(name: AnalogPin, micros: number): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.
|
||||||
|
*/
|
||||||
|
//% help=pins/on-pulsed weight=22 blockGap=8
|
||||||
|
//% blockId=pins_on_pulsed block="on|pin %pin|pulsed %pulse" shim=pins::onPulsed
|
||||||
|
function onPulsed(name: DigitalPin, pulse: PulseValue, body: () => void): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulse`` handler.
|
||||||
|
*/
|
||||||
|
//% help=pins/pulse-micros
|
||||||
|
//% blockId=pins_pulse_duration block="pulse duration (us)"
|
||||||
|
//% weight=21 shim=pins::pulseDuration
|
||||||
|
function pulseDuration(): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
||||||
* @param name pin to write to
|
* @param name pin to write to
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-microbit",
|
"name": "pxt-microbit",
|
||||||
"version": "0.2.114",
|
"version": "0.2.121",
|
||||||
"description": "BBC micro:bit target for PXT",
|
"description": "BBC micro:bit target for PXT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
@@ -29,6 +29,6 @@
|
|||||||
"typescript": "^1.8.7"
|
"typescript": "^1.8.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-core": "0.2.124"
|
"pxt-core": "0.2.129"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
"aspectRatio": 1.22
|
"aspectRatio": 1.22
|
||||||
},
|
},
|
||||||
"compileService": {
|
"compileService": {
|
||||||
"gittag": "v0.1.9",
|
"gittag": "v0.1.10",
|
||||||
"serviceId": "ws"
|
"serviceId": "ws"
|
||||||
},
|
},
|
||||||
"serial": {
|
"serial": {
|
||||||
|
|||||||
@@ -501,6 +501,13 @@ namespace pxsim.radio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace pxsim.pins {
|
namespace pxsim.pins {
|
||||||
|
export function onPulse(name: number, pulse: number, body: RefAction) {
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pulseDuration(): number {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
export function digitalReadPin(pinId: number): number {
|
export function digitalReadPin(pinId: number): number {
|
||||||
let pin = getPin(pinId);
|
let pin = getPin(pinId);
|
||||||
if (!pin) return;
|
if (!pin) return;
|
||||||
|
|||||||
@@ -234,8 +234,8 @@ namespace pxsim.micro_bit {
|
|||||||
|
|
||||||
let t = Math.max(tmin, Math.min(tmax, state.temperature))
|
let t = Math.max(tmin, Math.min(tmax, state.temperature))
|
||||||
let per = Math.floor((state.temperature - tmin) / (tmax - tmin) * 100)
|
let per = Math.floor((state.temperature - tmin) / (tmax - tmin) * 100)
|
||||||
svg.setGradientValue(this.thermometerGradient, 100 - per + '%');
|
svg.setGradientValue(this.thermometerGradient, 100 - per + "%");
|
||||||
this.thermometerText.textContent = t + '°C';
|
this.thermometerText.textContent = t + "°C";
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateHeading() {
|
private updateHeading() {
|
||||||
@@ -246,6 +246,7 @@ namespace pxsim.micro_bit {
|
|||||||
if (!this.headInitialized) {
|
if (!this.headInitialized) {
|
||||||
let p = this.head.firstChild.nextSibling as SVGPathElement;
|
let p = this.head.firstChild.nextSibling as SVGPathElement;
|
||||||
p.setAttribute("d", "m269.9,50.134647l0,0l-39.5,0l0,0c-14.1,0.1 -24.6,10.7 -24.6,24.8c0,13.9 10.4,24.4 24.3,24.7l0,0l39.6,0c14.2,0 40.36034,-22.97069 40.36034,-24.85394c0,-1.88326 -26.06034,-24.54606 -40.16034,-24.64606m-0.2,39l0,0l-39.3,0c-7.7,-0.1 -14,-6.4 -14,-14.2c0,-7.8 6.4,-14.2 14.2,-14.2l39.1,0c7.8,0 14.2,6.4 14.2,14.2c0,7.9 -6.4,14.2 -14.2,14.2l0,0l0,0z");
|
p.setAttribute("d", "m269.9,50.134647l0,0l-39.5,0l0,0c-14.1,0.1 -24.6,10.7 -24.6,24.8c0,13.9 10.4,24.4 24.3,24.7l0,0l39.6,0c14.2,0 40.36034,-22.97069 40.36034,-24.85394c0,-1.88326 -26.06034,-24.54606 -40.16034,-24.64606m-0.2,39l0,0l-39.3,0c-7.7,-0.1 -14,-6.4 -14,-14.2c0,-7.8 6.4,-14.2 14.2,-14.2l39.1,0c7.8,0 14.2,6.4 14.2,14.2c0,7.9 -6.4,14.2 -14.2,14.2l0,0l0,0z");
|
||||||
|
this.updateTheme();
|
||||||
let pt = this.element.createSVGPoint();
|
let pt = this.element.createSVGPoint();
|
||||||
svg.buttonEvents(
|
svg.buttonEvents(
|
||||||
this.head,
|
this.head,
|
||||||
@@ -253,13 +254,12 @@ namespace pxsim.micro_bit {
|
|||||||
let cur = svg.cursorPoint(pt, this.element, ev);
|
let cur = svg.cursorPoint(pt, this.element, ev);
|
||||||
state.heading = Math.floor(Math.atan2(cur.y - yc, cur.x - xc) * 180 / Math.PI + 90);
|
state.heading = Math.floor(Math.atan2(cur.y - yc, cur.x - xc) * 180 / Math.PI + 90);
|
||||||
if (state.heading < 0) state.heading += 360;
|
if (state.heading < 0) state.heading += 360;
|
||||||
console.log('heading: ' + state.heading)
|
|
||||||
this.updateHeading();
|
this.updateHeading();
|
||||||
});
|
});
|
||||||
this.headInitialized = true;
|
this.headInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let txt = state.heading.toString() + '°';
|
let txt = state.heading.toString() + "°";
|
||||||
if (txt != this.headText.textContent) {
|
if (txt != this.headText.textContent) {
|
||||||
svg.rotateElement(this.head, xc, yc, state.heading + 180);
|
svg.rotateElement(this.head, xc, yc, state.heading + 180);
|
||||||
this.headText.textContent = txt;
|
this.headText.textContent = txt;
|
||||||
@@ -273,7 +273,7 @@ namespace pxsim.micro_bit {
|
|||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
if (now - this.lastFlashTime > 150) {
|
if (now - this.lastFlashTime > 150) {
|
||||||
this.lastFlashTime = now;
|
this.lastFlashTime = now;
|
||||||
svg.animate(this.systemLed, 'sim-flash')
|
svg.animate(this.systemLed, "sim-flash")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,6 +437,18 @@ svg.sim.grayscale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* animations */
|
/* animations */
|
||||||
|
.sim-theme-glow {
|
||||||
|
animation-name: sim-theme-glow-animation;
|
||||||
|
animation-timing-function: ease-in-out;
|
||||||
|
animation-direction: alternate;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
animation-duration: 1.25s;
|
||||||
|
}
|
||||||
|
@keyframes sim-theme-glow-animation {
|
||||||
|
from { opacity: 1; }
|
||||||
|
to { opacity: 0.8; }
|
||||||
|
}
|
||||||
|
|
||||||
.sim-flash {
|
.sim-flash {
|
||||||
animation-name: sim-flash-animation;
|
animation-name: sim-flash-animation;
|
||||||
animation-duration: 0.1s;
|
animation-duration: 0.1s;
|
||||||
@@ -501,9 +513,9 @@ svg.sim.grayscale {
|
|||||||
// head
|
// head
|
||||||
this.head = <SVGGElement>svg.child(this.g, "g", {});
|
this.head = <SVGGElement>svg.child(this.g, "g", {});
|
||||||
svg.child(this.head, "circle", { cx: 258, cy: 75, r: 100, fill: "transparent" })
|
svg.child(this.head, "circle", { cx: 258, cy: 75, r: 100, fill: "transparent" })
|
||||||
this.logos.push(svg.path(this.head, "sim-theme", "M269.9,50.2L269.9,50.2l-39.5,0v0c-14.1,0.1-24.6,10.7-24.6,24.8c0,13.9,10.4,24.4,24.3,24.7v0h39.6c14.2,0,24.8-10.6,24.8-24.7C294.5,61,284,50.3,269.9,50.2 M269.7,89.2L269.7,89.2l-39.3,0c-7.7-0.1-14-6.4-14-14.2c0-7.8,6.4-14.2,14.2-14.2h39.1c7.8,0,14.2,6.4,14.2,14.2C283.9,82.9,277.5,89.2,269.7,89.2"));
|
this.logos.push(svg.path(this.head, "sim-theme sim-theme-glow", "M269.9,50.2L269.9,50.2l-39.5,0v0c-14.1,0.1-24.6,10.7-24.6,24.8c0,13.9,10.4,24.4,24.3,24.7v0h39.6c14.2,0,24.8-10.6,24.8-24.7C294.5,61,284,50.3,269.9,50.2 M269.7,89.2L269.7,89.2l-39.3,0c-7.7-0.1-14-6.4-14-14.2c0-7.8,6.4-14.2,14.2-14.2h39.1c7.8,0,14.2,6.4,14.2,14.2C283.9,82.9,277.5,89.2,269.7,89.2"));
|
||||||
this.logos.push(svg.path(this.head, "sim-theme", "M230.6,69.7c-2.9,0-5.3,2.4-5.3,5.3c0,2.9,2.4,5.3,5.3,5.3c2.9,0,5.3-2.4,5.3-5.3C235.9,72.1,233.5,69.7,230.6,69.7"));
|
this.logos.push(svg.path(this.head, "sim-theme sim-theme-glow", "M230.6,69.7c-2.9,0-5.3,2.4-5.3,5.3c0,2.9,2.4,5.3,5.3,5.3c2.9,0,5.3-2.4,5.3-5.3C235.9,72.1,233.5,69.7,230.6,69.7"));
|
||||||
this.logos.push(svg.path(this.head, "sim-theme", "M269.7,80.3c2.9,0,5.3-2.4,5.3-5.3c0-2.9-2.4-5.3-5.3-5.3c-2.9,0-5.3,2.4-5.3,5.3C264.4,77.9,266.8,80.3,269.7,80.3"));
|
this.logos.push(svg.path(this.head, "sim-theme sim-theme-glow", "M269.7,80.3c2.9,0,5.3-2.4,5.3-5.3c0-2.9-2.4-5.3-5.3-5.3c-2.9,0-5.3,2.4-5.3,5.3C264.4,77.9,266.8,80.3,269.7,80.3"));
|
||||||
this.headText = <SVGTextElement>svg.child(this.g, "text", { x: 310, y: 100, class: "sim-text" })
|
this.headText = <SVGTextElement>svg.child(this.g, "text", { x: 310, y: 100, class: "sim-text" })
|
||||||
|
|
||||||
// https://www.microbit.co.uk/device/pins
|
// https://www.microbit.co.uk/device/pins
|
||||||
@@ -567,9 +579,10 @@ svg.sim.grayscale {
|
|||||||
svg.path(this.g, "sim-label", "M35.7,376.4c0-2.8,2.1-5.1,5.5-5.1c3.3,0,5.5,2.4,5.5,5.1v4.7c0,2.8-2.2,5.1-5.5,5.1c-3.3,0-5.5-2.4-5.5-5.1V376.4zM43.3,376.4c0-1.3-0.8-2.3-2.2-2.3c-1.3,0-2.1,1.1-2.1,2.3v4.7c0,1.2,0.8,2.3,2.1,2.3c1.3,0,2.2-1.1,2.2-2.3V376.4z");
|
svg.path(this.g, "sim-label", "M35.7,376.4c0-2.8,2.1-5.1,5.5-5.1c3.3,0,5.5,2.4,5.5,5.1v4.7c0,2.8-2.2,5.1-5.5,5.1c-3.3,0-5.5-2.4-5.5-5.1V376.4zM43.3,376.4c0-1.3-0.8-2.3-2.2-2.3c-1.3,0-2.1,1.1-2.1,2.3v4.7c0,1.2,0.8,2.3,2.1,2.3c1.3,0,2.2-1.1,2.2-2.3V376.4z");
|
||||||
svg.path(this.g, "sim-label", "M136.2,374.1c2.8,0,3.4-0.8,3.4-2.5h2.9v14.3h-3.4v-9.5h-3V374.1z");
|
svg.path(this.g, "sim-label", "M136.2,374.1c2.8,0,3.4-0.8,3.4-2.5h2.9v14.3h-3.4v-9.5h-3V374.1z");
|
||||||
svg.path(this.g, "sim-label", "M248.6,378.5c1.7-1,3-1.7,3-3.1c0-1.1-0.7-1.6-1.6-1.6c-1,0-1.8,0.6-1.8,2.1h-3.3c0-2.6,1.8-4.6,5.1-4.6c2.6,0,4.9,1.3,4.9,4.3c0,2.4-2.3,3.9-3.8,4.7c-2,1.3-2.5,1.8-2.5,2.9h6.1v2.7h-10C244.8,381.2,246.4,379.9,248.6,378.5z");
|
svg.path(this.g, "sim-label", "M248.6,378.5c1.7-1,3-1.7,3-3.1c0-1.1-0.7-1.6-1.6-1.6c-1,0-1.8,0.6-1.8,2.1h-3.3c0-2.6,1.8-4.6,5.1-4.6c2.6,0,4.9,1.3,4.9,4.3c0,2.4-2.3,3.9-3.8,4.7c-2,1.3-2.5,1.8-2.5,2.9h6.1v2.7h-10C244.8,381.2,246.4,379.9,248.6,378.5z");
|
||||||
svg.path(this.g, "sim-label", "M48.1,270.9l-0.6-1.7h-5.1l-0.6,1.7h-3.5l5.1-14.3h3.1l5.2,14.3H48.1z M45,260.7l-1.8,5.9h3.5L45,260.7z");
|
|
||||||
|
|
||||||
svg.path(this.g, "sim-label", "M449.1,135.8h5.9c3.9,0,4.7,2.4,4.7,3.9c0,1.8-1.4,2.9-2.5,3.2c0.9,0,2.6,1.1,2.6,3.3c0,1.5-0.8,4-4.7,4h-6V135.8zM454.4,141.7c1.6,0,2-1,2-1.7c0-0.6-0.3-1.7-2-1.7h-2v3.4H454.4z M452.4,144.1v3.5h2.1c1.6,0,2-1,2-1.8c0-0.7-0.4-1.8-2-1.8H452.4z")
|
svg.path(this.g, "sim-button-label", "M48.1,270.9l-0.6-1.7h-5.1l-0.6,1.7h-3.5l5.1-14.3h3.1l5.2,14.3H48.1z M45,260.7l-1.8,5.9h3.5L45,260.7z");
|
||||||
|
svg.path(this.g, "sim-button-label", "M449.1,135.8h5.9c3.9,0,4.7,2.4,4.7,3.9c0,1.8-1.4,2.9-2.5,3.2c0.9,0,2.6,1.1,2.6,3.3c0,1.5-0.8,4-4.7,4h-6V135.8zM454.4,141.7c1.6,0,2-1,2-1.7c0-0.6-0.3-1.7-2-1.7h-2v3.4H454.4z M452.4,144.1v3.5h2.1c1.6,0,2-1,2-1.8c0-0.7-0.4-1.8-2-1.8H452.4z")
|
||||||
|
|
||||||
svg.path(this.g, "sim-label", "M352.1,381.1c0,1.6,0.9,2.5,2.2,2.5c1.2,0,1.9-0.9,1.9-1.9c0-1.2-0.6-2-2.1-2h-1.3v-2.6h1.3c1.5,0,1.9-0.7,1.9-1.8c0-1.1-0.7-1.6-1.6-1.6c-1.4,0-1.8,0.8-1.8,2.1h-3.3c0-2.4,1.5-4.6,5.1-4.6c2.6,0,5,1.3,5,4c0,1.6-1,2.8-2.1,3.2c1.3,0.5,2.3,1.6,2.3,3.5c0,2.7-2.4,4.3-5.2,4.3c-3.5,0-5.5-2.1-5.5-5.1H352.1z")
|
svg.path(this.g, "sim-label", "M352.1,381.1c0,1.6,0.9,2.5,2.2,2.5c1.2,0,1.9-0.9,1.9-1.9c0-1.2-0.6-2-2.1-2h-1.3v-2.6h1.3c1.5,0,1.9-0.7,1.9-1.8c0-1.1-0.7-1.6-1.6-1.6c-1.4,0-1.8,0.8-1.8,2.1h-3.3c0-2.4,1.5-4.6,5.1-4.6c2.6,0,5,1.3,5,4c0,1.6-1,2.8-2.1,3.2c1.3,0.5,2.3,1.6,2.3,3.5c0,2.7-2.4,4.3-5.2,4.3c-3.5,0-5.5-2.1-5.5-5.1H352.1z")
|
||||||
svg.path(this.g, "sim-label", "M368.5,385.9h-3.1l-5.1-14.3h3.5l3.1,10.1l3.1-10.1h3.6L368.5,385.9z")
|
svg.path(this.g, "sim-label", "M368.5,385.9h-3.1l-5.1-14.3h3.5l3.1,10.1l3.1-10.1h3.6L368.5,385.9z")
|
||||||
svg.path(this.g, "sim-label", "M444.4,378.3h7.4v2.5h-1.5c-0.6,3.3-3,5.5-7.1,5.5c-4.8,0-7.5-3.5-7.5-7.5c0-3.9,2.8-7.5,7.5-7.5c3.8,0,6.4,2.3,6.6,5h-3.5c-0.2-1.1-1.4-2.2-3.1-2.2c-2.7,0-4.1,2.3-4.1,4.7c0,2.5,1.4,4.7,4.4,4.7c2,0,3.2-1.2,3.4-2.7h-2.5V378.3z")
|
svg.path(this.g, "sim-label", "M444.4,378.3h7.4v2.5h-1.5c-0.6,3.3-3,5.5-7.1,5.5c-4.8,0-7.5-3.5-7.5-7.5c0-3.9,2.8-7.5,7.5-7.5c3.8,0,6.4,2.3,6.6,5h-3.5c-0.2-1.1-1.4-2.2-3.1-2.2c-2.7,0-4.1,2.3-4.1,4.7c0,2.5,1.4,4.7,4.4,4.7c2,0,3.2-1.2,3.4-2.7h-2.5V378.3z")
|
||||||
|
|||||||