Compare commits

...

103 Commits

Author SHA1 Message Date
Sam El-Husseini
436b56a2fa 0.7.48 2017-01-29 22:25:42 -08:00
Sam El-Husseini
7a41730f82 Bump pxt-core to 0.11.4 2017-01-29 22:25:41 -08:00
Sam El-Husseini
372ddfa641 0.7.47 2017-01-28 22:46:03 -08:00
Sam El-Husseini
30078923a3 Bump pxt-core to 0.11.3 2017-01-28 22:46:02 -08:00
Sam El-Husseini
5ab9222200 0.7.46 2017-01-28 21:59:48 -08:00
Sam El-Husseini
8ae5a48f1e Bump pxt-core to 0.11.2 2017-01-28 21:59:48 -08:00
Sam El-Husseini
f9ed37d07b Using pxtsemantic optimization 2017-01-28 21:55:48 -08:00
Peli de Halleux
edfbc4da18 0.7.45 2017-01-28 11:57:24 -08:00
Peli de Halleux
3a1c6a6ce3 Bump pxt-core to 0.11.1 2017-01-28 11:57:22 -08:00
Richard Knoll
9a4a2264fa Fixing singal strength docs and adding an example (#347) 2017-01-28 19:53:36 +00:00
Sam El-Husseini
e9558ce158 Fix svg scaling issue in IE. (#348)
* Fix svg scaling issue in IE. Fixes #1192

* minor fix
2017-01-28 19:53:05 +00:00
Sam El-Husseini
50677fadc4 Applying IE/Edge blockly css workaround 2017-01-26 14:47:15 -08:00
Richard Knoll
649e8f7c0f Fix neopixel transform in firefox (#345) 2017-01-26 02:51:26 +00:00
Peli de Halleux
0cb9c28f8d Merge branch 'master' of https://github.com/Microsoft/pxt-microbit 2017-01-23 03:54:58 -08:00
Peli de Halleux
004d9b4315 Adding pxt-microbit-GY521 repo 2017-01-23 03:52:53 -08:00
Sam El-Husseini
7a5b3aba01 Add hasAudio flag 2017-01-21 16:25:46 -08:00
Peli de Halleux
dc30263642 0.7.44 2017-01-20 15:42:48 -08:00
Peli de Halleux
619658a057 Bump pxt-core to 0.10.15 2017-01-20 15:42:46 -08:00
Peli de Halleux
472846bf3c 0.7.43 2017-01-20 15:16:42 -08:00
Peli de Halleux
ac4fbc850b Bump pxt-core to 0.10.14 2017-01-20 15:16:40 -08:00
Peli de Halleux
c7054b7ee0 Merge branch 'master' of https://github.com/Microsoft/pxt-microbit 2017-01-20 15:16:29 -08:00
Sam El-Husseini
559a43e17b 0.7.42 2017-01-20 15:05:50 -08:00
Sam El-Husseini
7671bc46ad Bump pxt-core to 0.10.13 2017-01-20 15:05:49 -08:00
Guillaume Jenkins
b3c5f2926d Electron release 0.7.41 2017-01-20 11:02:59 -08:00
Peli de Halleux
28830aa905 more info on on-start 2017-01-19 17:51:48 -08:00
Brahma Giri Abhijith Chatra
7fbbb5e65a release of beta 2017-01-19 16:55:20 -08:00
Peli de Halleux
51ebc29887 0.7.41 2017-01-19 16:09:32 -08:00
Peli de Halleux
f5d1722eae Bump pxt-core to 0.10.11 2017-01-19 16:09:29 -08:00
Michal Moskal
5f876d5ea9 Add openocd script (for pxt gdb) 2017-01-19 17:24:03 +00:00
Michal Moskal
31de8892fa Use standard type names
otherwise compilation fails on some yotta installs
2017-01-19 17:23:51 +00:00
Peli de Halleux
0d0a68122d 0.7.40 2017-01-19 00:19:15 -08:00
Peli de Halleux
4ad660568e Bump pxt-core to 0.10.10 2017-01-19 00:19:14 -08:00
Peli de Halleux
58e82a571d 0.7.39 2017-01-18 16:14:11 -08:00
Peli de Halleux
e629b866d5 Merge branch 'master' of https://github.com/Microsoft/pxt-microbit 2017-01-18 16:13:08 -08:00
Peli de Halleux
f0ac2b7a05 fixing debug message 2017-01-18 16:12:58 -08:00
Sam El-Husseini
e3c8db28e4 0.7.38 2017-01-18 14:48:43 -08:00
Sam El-Husseini
2c0e19a120 Bump pxt-core to 0.10.9 2017-01-18 14:48:42 -08:00
Peli de Halleux
595eb788b2 removed console.log for pxt.debug 2017-01-17 16:51:21 -08:00
Peli de Halleux
2e15d22e9e 0.7.37 2017-01-17 16:29:52 -08:00
Peli de Halleux
57082654a9 0.7.36 2017-01-17 14:55:44 -08:00
Peli de Halleux
8cbf7d38e3 0.7.35 2017-01-17 14:51:28 -08:00
Peli de Halleux
a99a7325bf 0.7.34 2017-01-17 14:13:06 -08:00
Peli de Halleux
fa3ed9dd21 0.7.33 2017-01-17 11:37:35 -08:00
Peli de Halleux
45fd40a553 adding on pin pressed in getting-started 2017-01-17 11:37:20 -08:00
Peli de Halleux
5a18bea9eb 0.7.32 2017-01-17 11:28:38 -08:00
Peli de Halleux
d310312841 Bump pxt-core to 0.10.8 2017-01-17 11:28:35 -08:00
Peli de Halleux
a4b93f7199 support for deletable on start 2017-01-17 11:18:22 -08:00
Sam El-Husseini
538a4b7bbf 0.7.31 2017-01-13 18:11:03 -08:00
Sam El-Husseini
0078e7bc12 Bump pxt-core to 0.10.7 2017-01-13 18:11:02 -08:00
Sam El-Husseini
d2726133a9 Revert "Control event value in simulator (#343)"
This reverts commit 00f4c9cbb3.
2017-01-13 18:04:38 -08:00
chmora
00f4c9cbb3 Control event value in simulator (#343)
* implement pxsim.control.eventValue and pxsim.control.eventTimestamp in the simulator
2017-01-13 16:46:52 -08:00
Sam El-Husseini
e15da5dee1 0.7.30 2017-01-13 15:47:16 -08:00
Sam El-Husseini
85dda4ea84 Bump pxt-core to 0.10.4 2017-01-13 15:47:15 -08:00
Guillaume Jenkins
a3ffe4e1cf Set latest Electron to 0.7.29 (#342) 2017-01-13 14:11:46 -08:00
Sam El-Husseini
90c4d4f73b 0.7.29 2017-01-13 13:55:44 -08:00
Sam El-Husseini
6484d559d6 Bump pxt-core to 0.10.2 2017-01-13 13:55:43 -08:00
Peli de Halleux
357436f14d refactored servostate (#341)
* refactored servostate

* Bump pxt-core to 0.10.1
2017-01-12 23:09:53 -08:00
Peli de Halleux
85fe96b3fd 0.7.28 2017-01-12 16:08:35 -08:00
Peli de Halleux
cdac932c42 Bump pxt-core to 0.9.5 2017-01-12 16:08:32 -08:00
Peli de Halleux
dcfc2a110d Merge branch 'master' of https://github.com/Microsoft/pxt-microbit 2017-01-12 16:07:19 -08:00
Peli de Halleux
e9561f54c3 removing custom loader logic 2017-01-12 16:07:10 -08:00
chmora
86f6b58d38 fix"string compare works differently in simulator/on target" (#340)
* fix for "string compare works differently in simulator/on target", fixes #901
2017-01-12 15:50:39 -08:00
Peli de Halleux
eee52a5c04 0.7.27 2017-01-12 15:27:07 -08:00
Peli de Halleux
1a0b0eac71 Bump pxt-core to 0.9.4 2017-01-12 15:27:04 -08:00
Peli de Halleux
5a98ae0bb8 0.7.26 2017-01-12 11:54:33 -08:00
Peli de Halleux
a9eea9a618 Bump pxt-core to 0.9.3 2017-01-12 11:54:30 -08:00
Peli de Halleux
3086c521e3 0.7.25 2017-01-12 11:33:08 -08:00
Peli de Halleux
6788f79650 Bump pxt-core to 0.9.2 2017-01-12 11:33:05 -08:00
Sam El-Husseini
5900239045 changing editor button colors 2017-01-12 10:45:39 -08:00
Peli de Halleux
248267ec2c 0.7.24 2017-01-10 17:47:09 -08:00
Peli de Halleux
9429075555 Bump pxt-core to 0.8.14 2017-01-10 17:47:07 -08:00
Peli de Halleux
1fa871f2e7 Support for serial events (#339)
* added "serial->on data received"

* updated info

* updated docs

* added readline to read entire buffer

* lazy initialize of serial buffers

* init async on event

* updated docs
2017-01-10 16:27:02 -08:00
chmora
04dab7df2c One letter showString shouldn't disappear (#338)
* Fix for "One letter showString shouldn't disappear", fixes #798

* miss semicolon
2017-01-10 16:25:40 -08:00
Guillaume Jenkins
b6474467bc Electron release (#333)
Set latest Electron app release to 0.7.23
2017-01-10 14:16:13 -08:00
Peli de Halleux
79ead74af4 0.7.23 2017-01-10 10:31:04 -08:00
Peli de Halleux
0f8ff95b72 Bump pxt-core to 0.8.13 2017-01-10 10:30:58 -08:00
Peli de Halleux
05028c4527 Serial events (#337)
* added "serial->on data received"

* updated info

* updated docs

* added readline to read entire buffer

* lazy initialize of serial buffers

* init async on event

* updated docs
2017-01-10 10:26:44 -08:00
Peli de Halleux
4054da3483 0.7.22 2017-01-09 21:33:47 -08:00
Peli de Halleux
7052d27d6d Bump pxt-core to 0.8.12 2017-01-09 21:33:44 -08:00
Abhijith Chatra
365af8d672 Merge pull request #335 from Microsoft/default
Default values for array
2017-01-09 20:35:56 -08:00
Sam El-Husseini
5086ca308c 0.7.21 2017-01-09 16:08:58 -08:00
Sam El-Husseini
c1af770afc Bump pxt-core to 0.8.11 2017-01-09 16:08:58 -08:00
Sam El-Husseini
e175e70d01 Merge branch 'master' into editortoolbox 2017-01-09 16:01:35 -08:00
Peli de Halleux
cbc228dca3 negative scroll fix
fix for Microsoft/pxt#813
2017-01-09 14:17:19 -08:00
Peli de Halleux
462127c661 Loader (#336)
* Custom microbit loader

* updated animation

* use standardized name

* moving loader support to pxt
2017-01-09 07:51:00 -08:00
Michal Moskal
487da05eca Fix for https://github.com/Microsoft/pxt/issues/1057 2017-01-09 10:58:24 +00:00
Brahma Giri Abhijith Chatra
c938618d29 adding default values for beyond the array.length access 2017-01-08 19:08:09 -08:00
Abhijith
91321dab83 Support for default values in array. 2017-01-08 18:43:14 -08:00
Sam El-Husseini
0cb3d6e44e Changes accompanying the editor toolbox. 2017-01-07 17:35:54 -08:00
Peli de Halleux
7a98b06424 Custom microbit loader (#334)
* Custom microbit loader

* updated animation

* use standardized name
2017-01-06 17:39:48 -08:00
Guillaume Jenkins
69c80d3aff Add css and default icon to NPM package for Electron app (#332) 2017-01-06 16:29:48 -08:00
Peli de Halleux
1d82f08668 update instructions to use inline buttons 2017-01-06 14:41:33 -08:00
Peli de Halleux
4681a68ffd added avatar image 2017-01-06 09:51:19 -08:00
Peli de Halleux
0a69b773de missing package annotation 2017-01-06 07:19:00 -08:00
Peli de Halleux
3f66a1c16d 0.7.20 2017-01-06 07:13:39 -08:00
Peli de Halleux
d78781ad5a Bump pxt-core to 0.8.8 2017-01-06 07:13:38 -08:00
Peli de Halleux
46281c3cd0 fixing broken links in docs 2017-01-06 06:12:39 -08:00
Peli de Halleux
a58f67064f 0.7.19 2017-01-06 06:03:43 -08:00
Peli de Halleux
efe784441f Bump pxt-core to 0.8.7 2017-01-06 06:03:41 -08:00
Peli de Halleux
05174f094a updated translations 2017-01-06 06:03:33 -08:00
Peli de Halleux
42773a1a0a updatd weights of radio 2017-01-06 05:43:50 -08:00
Peli de Halleux
32f96d09d4 removing "getting-started" link 2017-01-06 04:58:00 -08:00
Peli de Halleux
05d88cb4ba updated getting -started 2017-01-06 04:32:53 -08:00
61 changed files with 662 additions and 318 deletions

View File

@@ -2,6 +2,10 @@
### @description Language constructs for the Block editor.
Blocks snap into each other to define the program that your @boardname@ will run.
Blocks can be event (buttons, shake, ...) or need to be snapped into an event to run.
The [on-start](/blocks/on-start) event runs first.
```namespaces
for (let i = 0;i<5;++i) {}
if (true){}

View File

@@ -16,7 +16,13 @@ input.onButtonPressed(Button.A, () => {
led.setBrightness(50)
```
## What about JavaScript?
``on-start`` only exists in the block editor. In JavaScript, all code executes sequentially from the first line.
## Hey, my events moved!
When we transform the blocks into JavaScript, we always place all the event registrations (buttons, shake, ...)
before launching the ``on start`` code.
If a block from ``on start`` pauses, other registered events will have the opportunity to run as well.

View File

@@ -1,3 +1,3 @@
{
"appref": "v0.6.36"
"appref": "v0.7.41"
}

View File

@@ -16,10 +16,10 @@ at a certain pace. In the code below, the user pressed button ``A`` to launch th
```blocks
input.onButtonPressed(Button.A, () => {
pins.servoWritePin(AnalogPin.P0, 0)
basic.pause(500)
pins.servoWritePin(AnalogPin.P0, 180)
basic.pause(500)
pins.servoWritePin(AnalogPin.P0, 0);
basic.pause(500);
pins.servoWritePin(AnalogPin.P0, 180);
basic.pause(500);
});
```
@@ -45,4 +45,8 @@ radio.onDataPacketReceived(({receivedNumber}) => {
input.onButtonPressed(Button.A, () => {
radio.sendNumber(0)
})
```
```package
radio
```

View File

@@ -41,7 +41,7 @@ Using the cutting pliers, cut out the dark plastic connector.
Using the plier or a wire stripper, strip the plastic from the cables.
![](/static/mb/projects/inchworm/servo2.jpg)
![](/static/mb/projects/inchworm/servotrim.jpg)
## Step 3: threading the servo cablers

View File

@@ -25,7 +25,7 @@ bluetooth.advertiseUidBuffer(pins.createBuffer(16), 7, true);
* ``buffer`` - a 16 bytes buffer containing the namespace (first 10 bytes) and instance (last 6 bytes).
* ``power`` - a [number](/reference/types/number) representing the power level between 0 (short) and 7 (maximum range).
* ``connectable`` - a [boolean](/reference/type/boolean) indicating whether or not the micro:bit should accept connections.
* ``connectable`` - a [boolean](/blocks/logic/boolean) indicating whether or not the micro:bit should accept connections.
## See Also

View File

@@ -26,7 +26,7 @@ bluetooth.advertiseUid(42, 1, 7, true);
* ``namespace`` last 4 bytes of the namespace uid (6 to 9)
* ``instance`` last 4 bytes of the instance (2 to 5)
* ``power`` - a [number](/reference/types/number) representing the power level between 0 (short) and 7 (maximum range).
* ``connectable`` - a [boolean](/reference/type/boolean) indicating whether or not the micro:bit should accept connections.
* ``connectable`` - a [boolean](/blocks/logic/boolean) indicating whether or not the micro:bit should accept connections.
## Encoding

View File

@@ -25,7 +25,7 @@ bluetooth.advertiseUrl("https://pxt.microbit.org/", 7, true);
* ``url`` - a [string](/reference/types/string) containing the URL to broadcast, at most 17 characters long, excluding the protocol (eg: ``https://``) which gets encoded as 1 byte.
* ``power`` - a [number](/reference/types/number) representing the power level between 0 (short) and 7 (maximum range).
* ``connectable`` - a [boolean](/reference/type/boolean) indicating whether or not the micro:bit should accept connections.
* ``connectable`` - a [boolean](/blocks/logic/boolean) indicating whether or not the micro:bit should accept connections.
### Example: Broadcast a secret code

View File

@@ -21,7 +21,7 @@ To add or remove the parts of the packet from the block, try clicking the blue g
* `receivedString` - The [string](/reference/types/string) that was sent in this packet or the empty string if this packet did not contain a string. See [send string](/reference/radio/send-string) and [send value](/reference/radio/send-value)
* `time` - The system time of the @boardname@ that sent this packet at the time the packet was sent.
* `serial` - The serial number of the @boardname@ that sent this packet or `0` if the @boardname@ did not include its serial number.
* `signal` - How strong the radio signal is from `255` (weak) to `0` (strong).
* `signal` - How strong the radio signal is from `-128` (weak) to `-42` (strong).
### Example
@@ -39,6 +39,23 @@ radio.onDataPacketReceived(({ receivedNumber }) => {
})
```
### Example
This program uses the signal strength from received packets to graph the
approximate distance between two @boardname@s.
```blocks
basic.forever(() => {
radio.sendNumber(0)
})
radio.onDataPacketReceived(({ signal, receivedNumber }) => {
led.plotBarGraph(
Math.abs(signal + 42),
128 - 42
)
})
```
### See also
[send number](/reference/radio/send-number),

View File

@@ -2,8 +2,8 @@
> Note: This API has been deprecated! Use [on data packet received](/reference/radio/on-data-packet-received) instead.
Find how strong the ``radio`` signal is, from `255` to `0`.
(`255` means a weak signal and `0` means a strong one.)
Find how strong the ``radio`` signal is, from `-128` to `-42`.
(`-128` means a weak signal and `-42` means a strong one.)
The @boardname@ finds the signal strength by checking how strong it was
the last time it ran the
@@ -16,7 +16,7 @@ radio.receivedSignalStrength();
### Returns
* a [number](/reference/types/number) between `255` and `0` that means
* a [number](/reference/types/number) between `-128` and `-42` that means
how strong the signal is.
### Simulator

View File

@@ -7,8 +7,11 @@ serial.writeLine("");
serial.writeNumber(0);
serial.writeValue("x", 0);
serial.writeString("");
serial.readUntil(",");
serial.readLine();
serial.readString();
serial.redirect(SerialPin.P0, SerialPin.P0, BaudRate.BaudRate115200);
serial.onDataReceived(",", () => {})
```
### See Also

View File

@@ -0,0 +1,29 @@
# Serial On Data Received
Registers an event to be fired when one of the delimiter is matched.
```sig
serial.onDataReceived(",", () => {})
```
### Parameters
* `delimiters` is a [string](/reference/types/string) containing any of the character to match
### Example
Read values separated by `,`:
```blocks
serial.onDataReceived(serial.delimiters(Delimiters.Comma), () => {
basic.showString(serial.readUntil(serial.delimiters(Delimiters.Comma)))
})
```
### See also
[serial](/device/serial),
[serial write line](/reference/serial/write-line),
[serial write value](/reference/serial/write-value)

View File

@@ -0,0 +1,27 @@
# Serial Read String
Read the buffered serial data as a string
```sig
serial.readString();
```
### Returns
* a [string](/reference/types/string) containing input from the serial port. Empty if no data available.
### Example
The following program scrolls text on the screen as it arrives from serial.
```blocks
basic.forever(() => {
basic.showString(serial.readString());
});
```
### See also
[serial](/device/serial),
[serial write line](/reference/serial/write-line),
[serial write value](/reference/serial/write-value)

61
docs/static/avatar.svg vendored Normal file
View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
role="img"
aria-labelledby="title desc"
xml:space="preserve"
enable-background="new 0 0 280 32.755"
height="52.672001"
width="52.672001"
version="1.1"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo.square.black.svg"><sodipodi:namedview
pagecolor="#ff00ff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1536"
inkscape:window-height="801"
id="namedview14"
showgrid="false"
inkscape:zoom="2.0836233"
inkscape:cx="83.390493"
inkscape:cy="16.071144"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><rect
id="backgroundrect"
width="195.47368"
height="34.210526"
x="0"
y="18.461473"
class=""
style="fill:none;stroke:none" /><title
id="title"
lang="en-GB">BBC micro:bit</title><desc
id="desc"
lang="en-GB">BBC micro:bit logo</desc><metadata
id="metadata37"><rdf:rdf><cc:work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:work></rdf:rdf><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>BBC micro:bit</dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs35" /><path
inkscape:connector-curvature="0"
class=""
d="m 37.363,29.377 c -1.677,0 -3.035,-1.364 -3.035,-3.042 0,-1.678 1.357,-3.038 3.035,-3.038 1.684,0 3.039,1.36 3.039,3.038 0,1.678 -1.355,3.042 -3.039,3.042 M 15.052,23.3 c -1.677,0 -3.042,1.357 -3.042,3.035 0,1.678 1.363,3.042 3.042,3.042 1.674,0 3.036,-1.364 3.036,-3.042 0,-1.678 -1.363,-3.035 -3.036,-3.035 m -0.003,-5.99 22.576,0 c 4.979,0 9.027,4.047 9.027,9.027 0,4.979 -4.049,9.031 -9.027,9.031 l -22.576,0 c -4.977,0 -9.0299993,-4.053 -9.0299993,-9.031 C 6.0180007,21.357 10.072,17.31 15.049,17.31 m 22.576,24.076 c 8.299,0 15.047,-6.75 15.047,-15.049 0,-8.299 -6.748,-15.051 -15.047,-15.051 l -22.576,0 C 6.7500007,11.286 6.9250488e-7,18.038 6.9250488e-7,26.337 6.9250488e-7,34.636 6.7500007,41.386 15.049,41.386 l 22.576,0"
id="path21"
style="fill:#000000"
sodipodi:nodetypes="csssccsssccsssscccsssssc" /></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

61
docs/static/loader.svg vendored Normal file
View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
role="img"
aria-labelledby="title desc"
xml:space="preserve"
enable-background="new 0 0 280 32.755"
height="52.672001"
width="52.672001"
version="1.1"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="logo.square.white.svg"><sodipodi:namedview
pagecolor="#ff00ff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1536"
inkscape:window-height="801"
id="namedview14"
showgrid="false"
inkscape:zoom="2.0836233"
inkscape:cx="83.390493"
inkscape:cy="16.071144"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><rect
id="backgroundrect"
width="195.47368"
height="34.210526"
x="0"
y="18.461473"
class=""
style="fill:none;stroke:none" /><title
id="title"
lang="en-GB">BBC micro:bit</title><desc
id="desc"
lang="en-GB">BBC micro:bit logo</desc><metadata
id="metadata37"><rdf:rdf><cc:work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:work></rdf:rdf><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>BBC micro:bit</dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs35" /><path
inkscape:connector-curvature="0"
class=""
d="m 37.363,29.377 c -1.677,0 -3.035,-1.364 -3.035,-3.042 0,-1.678 1.357,-3.038 3.035,-3.038 1.684,0 3.039,1.36 3.039,3.038 0,1.678 -1.355,3.042 -3.039,3.042 M 15.052,23.3 c -1.677,0 -3.042,1.357 -3.042,3.035 0,1.678 1.363,3.042 3.042,3.042 1.674,0 3.036,-1.364 3.036,-3.042 0,-1.678 -1.363,-3.035 -3.036,-3.035 m -0.003,-5.99 22.576,0 c 4.979,0 9.027,4.047 9.027,9.027 0,4.979 -4.049,9.031 -9.027,9.031 l -22.576,0 c -4.977,0 -9.0299993,-4.053 -9.0299993,-9.031 C 6.0180007,21.357 10.072,17.31 15.049,17.31 m 22.576,24.076 c 8.299,0 15.047,-6.75 15.047,-15.049 0,-8.299 -6.748,-15.051 -15.047,-15.051 l -22.576,0 C 6.7500007,11.286 6.9250488e-7,18.038 6.9250488e-7,26.337 6.9250488e-7,34.636 6.7500007,41.386 15.049,41.386 l 22.576,0"
id="path21"
style="fill:#ffffff"
sodipodi:nodetypes="csssccsssccsssscccsssssc" /></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -11,8 +11,7 @@
aria-labelledby="title desc"
xml:space="preserve"
enable-background="new 0 0 280 32.755"
height="52.672001"
width="52.672001"
viewBox="0 0 52.672001 52.672001"
version="1.1"
id="svg2"
inkscape:version="0.91 r13725"

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -11,8 +11,7 @@
aria-labelledby="title desc"
xml:space="preserve"
enable-background="new 0 0 280 32.755"
height="52.672001"
width="52.672001"
viewBox="0 0 52.672001 52.672001"
version="1.1"
id="svg2"
inkscape:version="0.91 r13725"

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -2,52 +2,73 @@
### Step 1
Use the **Basic** drawer in the editor
to drag out and arrange three blocks to create this program:
Place blocks in the workspace to scroll text on the screen.
```block
basic.showString("Hello world")
```blocks
basic.showString("Hello!")
```
### Step 2
Use the **Basic** drawer in the editor
to drag out and arrange three blocks to create this program:
Click ``|Download|`` to transfer your code in your @boardname@!
### Step 3
Use the **Basic** drawer in the editor
to drag out and arrange three blocks to create this program:
```block
basic.forever(() => {
basic.showNumber(0)
})
```
### Step 4
Use the **Basic** drawer in the editor
to drag out and arrange three blocks to create this program:
```block
input.onButtonPressed(Button.B, () => {
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
})
```
### Step 5
Use the **Basic** drawer in the editor
to drag out and arrange three blocks to create this program:
Great, the text scrolled! But then it stopped.
Let's make it scroll when button **A** is pressed.
```block
input.onButtonPressed(Button.A, () => {
basic.showString("Hello!")
});
```
### Step 4
Click ``|Download|`` to transfer your code
and press **A** to scroll your text.
### Step 5
Place more blocks to display a smiley when button **B** is pressed.
Use the dropdown to find ``B``!
```block
input.onButtonPressed(Button.B, () => {
basic.showLeds(`
# # . # #
# # . # #
. . . . .
# . . . #
. # # # .
`)
})
```
### Step 6
Drag more blocks to display a frownie when @boardname@ is shaken.
```block
input.onGesture(Gesture.Shake, () => {
basic.showLeds(`
# # . # #
# # . # #
. . . . .
. # # # .
# . . . #
`)
})
```
### Step 7
Drag more blocks to display a random number when pin ``P0`` is touched.
Hold your right thumb on the ``GND`` metal pin
at press the ``0`` pin with your right hand to trigger this event.
```block
input.onPinPressed(TouchPin.P0, () => {
basic.showNumber(Math.random(7))
})
```

View File

@@ -1,9 +1,9 @@
{
"versions": {
"0": {
"latest": "v0.6.45",
"latest": "v0.7.41",
"banned": [],
"prompt": "v0.0.0"
"prompt": "v0.7.41"
}
}
}

View File

@@ -1,3 +1,4 @@
<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="pxt-on-start"></block>
<block type="device_forever"></block>
</xml>

View File

@@ -7,7 +7,7 @@ using namespace pxt;
/**
* Support for additional Bluetooth services.
*/
//% color=#0082FB weight=20 icon="\uf294"
//% color=#0082FB weight=96 icon="\uf294"
namespace bluetooth {
MicroBitUARTService *uart = NULL;

View File

@@ -1,7 +1,7 @@
/**
* Support for additional Bluetooth services.
*/
//% color=#0082FB weight=20 icon="\uf294"
//% color=#0082FB weight=96 icon="\uf294"
namespace bluetooth {
/**
* Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.

View File

@@ -6,7 +6,8 @@
"enums.d.ts",
"shims.d.ts",
"bluetooth.ts",
"bluetooth.cpp"
"bluetooth.cpp",
"_locales/de/bluetooth-jsdoc-strings.json"
],
"public": true,
"dependencies": {
@@ -46,7 +47,7 @@
"microbit-dal": {
"bluetooth": {
"open": 1,
"pairing_mode": 0,
"pairing_mode": 0,
"whitelist": 0,
"security_level": null
}

View File

@@ -4,7 +4,7 @@
/**
* Support for additional Bluetooth services.
*/
//% color=#0082FB weight=20 icon="\uf294"
//% color=#0082FB weight=96 icon="\uf294"
declare namespace bluetooth {
/**

View File

@@ -231,8 +231,10 @@
"pins.spiWrite|param|value": "Data to be sent to the SPI slave",
"serial": "Reading and writing data over a serial connection.",
"serial.delimiters": "Returns the delimiter corresponding string",
"serial.onLineReceived": "Registers an event to be fired when a line has been received",
"serial.onDataReceived": "Registers an event to be fired when one of the delimiter is matched.",
"serial.onDataReceived|param|delimiters": "the characters to match received characters against.",
"serial.readLine": "Reads a line of text from the serial port.",
"serial.readString": "Reads the buffered received data as a string",
"serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.",
"serial.readUntil|param|delimiter": "text delimiter that separates each text chunk",
"serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.",

View File

@@ -171,7 +171,9 @@
"pins.spiWrite|block": "spi write %value",
"pins|block": "pins",
"serial.delimiters|block": "%del",
"serial.onDataReceived|block": "serial|on data received %delimiters=serial_delimiter_conv",
"serial.readLine|block": "serial|read line",
"serial.readString|block": "serial|read string",
"serial.readUntil|block": "serial|read until %delimiter=serial_delimiter_conv",
"serial.redirect|block": "serial|redirect to|TX %tx|RX %rx|at baud rate %rate",
"serial.writeLine|block": "serial|write line %text",

View File

@@ -64,7 +64,6 @@
"control.waitMicros|param|micros": "Anzahl der Mikrosekunden, die gewartet werden soll, z.B.: 4",
"game": "Eine Einzel-LED-Sprite-Spielumgebung",
"game.addLife": "Fügt Leben zum aktuellen Spielstand hinzu",
"game.addLife|param|lives": "TODO",
"game.addScore": "Fügt zum aktuellen Spielstand Punkte hinzu",
"game.addScore|param|points": "Anzahl von zu verändernden Punkten, z.B.: 1",
"game.createSprite": "Erzeugt einen neuen LED-Sprite, der nach rechts zeigt.",
@@ -79,12 +78,9 @@
"game.levelUp": "Erhöht das Level und zeigt eine Nachricht an.",
"game.life": "Ruft das aktuelle Leben ab",
"game.removeLife": "Entfernt ein Leben",
"game.removeLife|param|life": "TODO",
"game.score": "Ruft den aktuellen Punktestand ab",
"game.setLife": "Setzt den aktuellen Wert der Leben",
"game.setLife|param|value": "TODO",
"game.setScore": "Setzt den aktuellen Wert des Spielstands",
"game.setScore|param|value": "TODO",
"game.showScore": "Zeigt den Spielstand auf dem Display.",
"game.startCountdown": "Startet einen Spiel-Countdown",
"game.startCountdown|param|ms": "Countdown-Dauer in Millisekunden, z.B.: 10000",
@@ -94,38 +90,24 @@
"images.createImage": "Erstellt ein Bild, das auf den LED-Bildschirm passt.",
"input": "Ereignisse und Daten der Sensoren",
"input.acceleration": "Holt den Beschleunigungswert in Milli-Erdanziehung (wenn das Board flach mit dem Display nach oben liegt, X = 0, y = 0 und Z =-1024)",
"input.acceleration|param|dimension": "TODO",
"input.buttonIsPressed": "Erhalte den Sie den Tastenstatus (gepresst oder nicht) für ``A`` und ``B``.",
"input.calibrate": "Veraltet, Kompasskalibrierung erfolgt automatisch.",
"input.compassHeading": "Holt die aktuelle Kompassrichtung in Grad.",
"input.lightLevel": "Liest die Lichtintensität auf dem LED-Bildschirm im Bereich von ``0`` (dunkel) und `` 255`` (hell).",
"input.magneticForce": "Ruft den Wert der Magnetkraft in ``Mikro-Tesla`` (``µT``) ab. Diese Funktion wird im Simulator nicht unterstützt.",
"input.magneticForce|param|dimension": "TODO",
"input.onButtonPressed": "Tue etwas, wenn eine Taste (``A``, ``B`` oder ``A + B``) gedrückt wird",
"input.onButtonPressed|param|body": "TODO",
"input.onButtonPressed|param|button": "TODO",
"input.onGesture": "Mache etwas, wenn eine Geste gemacht wird (wie den mini zu schütteln).",
"input.onGesture|param|body": "TODO",
"input.onLogoDown": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach unten zeigt und das Board vertikal ausgerichtet ist.",
"input.onLogoDown|param|body": "TODO",
"input.onLogoUp": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach oben zeigt und das Board vertikal ausgerichtet ist.",
"input.onLogoUp|param|body": "TODO",
"input.onPinPressed": "Mache etwas, wenn eine Pin gehalten wird.",
"input.onPinPressed|param|body": "Code, der ausführt wird, wenn ein Pin gehalten wird",
"input.onPinPressed|param|name": "Der Pin, der gehalten werden muss",
"input.onPinReleased": "Mache etwas, wenn der Pin losgelassen wird.",
"input.onPinReleased|param|body": "Code, der ausgeführt werden soll, wenn der Pin losgelassen wird",
"input.onPinReleased|param|name": "Der Pin, der losgelassen werden muss",
"input.onScreenDown": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach unten zeigt.",
"input.onScreenDown|param|body": "TODO",
"input.onScreenUp": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach oben zeigt.",
"input.onScreenUp|param|body": "TODO",
"input.onShake": "Hängt Code an, der ausgeführt wird, wenn der mini geschüttelt wird.",
"input.onShake|param|body": "TODO",
"input.pinIsPressed": "Ruft den Pin-Zustand (gehalten oder nicht) ab. Die Erdung muss gehalten werden, um den Stromkreis zu schließen.",
"input.pinIsPressed|param|name": "Pin, der verwendet wird, um eine Berührung zu erkennen",
"input.rotation": "Die Neigung und Drehung des mini Drehung auf ``X-Achse``oder ``Y-Achse``, in Grad.",
"input.rotation|param|kind": "TODO",
"input.runningTime": "Ruft die Anzahl der Millisekunden auf, die seit dem Einschalten vergangen sind.",
"input.setAccelerometerRange": "Legt die Stichprobenbereich des Beschleunigungssensors in Schwerkraft fest.",
"input.setAccelerometerRange|param|range": "Ein Wert, der die maximale Stärke der gemessenen Beschleunigung beschreibt",
@@ -134,19 +116,13 @@
"led.brightness": "Ruft die Helligkeit des Bildschirms ab, von 0 (aus) bis 255 (volle Helligkeit).",
"led.enable": "Schaltet das Display an und aus",
"led.fadeIn": "Blendet die Bildschirmanzeige ein.",
"led.fadeIn|param|ms": "TODO",
"led.fadeOut": "Blendet die Bildschirmhelligkeit aus.",
"led.fadeOut|param|ms": "TODO",
"led.plot": "Schalte die angegebene LED mit Hilfe von X- und Y-Koordinaten ein (X ist horizontal, Y ist vertikal). (0,0) ist die obere linke Ecke.",
"led.plotAll": "Schaltet alle LEDs an",
"led.plotBarGraph": "Zeigt ein vertikales Balkendiagramm an, basierend auf dem `Wert`und dem `Hoch`-Wert. Wenn `Hoch`0 ist, wird das Diagramm automatisch angepasst.",
"led.plotBarGraph|param|high": "maximalen Wert. Wenn dieser 0 ist, wird der Maximalwert automatisch angepasst, z.B.: 0",
"led.plotBarGraph|param|value": "aktueller Wert zum Darstellen",
"led.plot|param|x": "TODO",
"led.plot|param|y": "TODO",
"led.point": "Ruft den An/Aus-Status einer vorgegebenen LED mittels X-/Y-Koordinaten ab. (0,0) ist oben links.",
"led.point|param|x": "TODO",
"led.point|param|y": "TODO",
"led.screenshot": "Macht einen Screenshot vom LED-Bildschirm und gibt ein Bild aus.",
"led.setBrightness": "Lege die Helligkeit des Bildschirms fest, von 0 (aus) bis 255 (volle Helligkeit).",
"led.setBrightness|param|value": "Helligkeitswert, z.B.: 255, 127, 0",
@@ -155,17 +131,12 @@
"led.stopAnimation": "Bricht die aktuelle Animation ab und löscht andere ausstehende Animationen.",
"led.toggle": "Schaltet ein bestimmtes Pixel ein",
"led.toggleAll": "Invertiert die aktuelle LED-Anzeige",
"led.toggle|param|x": "TODO",
"led.toggle|param|y": "TODO",
"led.unplot": "Schalte die angegebene LED mit x-und y-Koordinaten ab (X ist horizontal, y ist vertikal). (0,0) ist oben links.",
"led.unplot|param|x": "TODO",
"led.unplot|param|y": "TODO",
"music": "Generierung von von Musik durch Pin ``P0``.",
"music.beat": "Gibt die Dauer eines Taktes in Milli-Sekunden aus",
"music.changeTempoBy": "Ändere die Geschwindigkeit um den angegebenen Betrag",
"music.changeTempoBy|param|bpm": "Die Änderung in Schlägen pro Minute auf das Tempo, z.B.: 20",
"music.noteFrequency": "Ruft die Frequenz einer Note ab.",
"music.noteFrequency|param|name": "der Name der Notiz",
"music.playTone": "Spielt einen Ton für den angegebenen Zeitraum über Pin ``P0`` ab.",
"music.playTone|param|frequency": "Tonhöhe des abzuspielenden Tones in Hertz (Hz)",
"music.playTone|param|ms": "Tondauer in Millisekunden (ms)",
@@ -181,21 +152,15 @@
"pins.analogPitch|param|frequency": "TODO",
"pins.analogPitch|param|ms": "TODO",
"pins.analogReadPin": "Lese den Anschlusswert als Analog aus, d. h. als einen Wert zwischen 0 und 1023.",
"pins.analogReadPin|param|name": "Pin, auf den geschrieben werden soll",
"pins.analogSetPeriod": "Stellt die Pulsweite Modulation (PWM) des Analogausganges auf den angegebenen Wert in ** Mikrosekunden ** oder `1/1000` Millisekunden ein.\nWenn dieser Pin nicht als einen Analogausgang (mit `analog write pin`) konfiguriert ist, hat der Vorgang keine Auswirkungen.",
"pins.analogSetPeriod|param|micros": "Zeit in Mikrosekunden. z.B.: 20000",
"pins.analogSetPeriod|param|name": "analoger Pin, der zeitlich festgelegt werden soll",
"pins.analogSetPitchPin": "Setzt den genutzten Pin, wenn `pins->analog pitch`angewendet wird.",
"pins.analogSetPitchPin|param|name": "TODO",
"pins.analogWritePin": "Legt den Wert des Verbinders auf analog fest. Der Wert muss zwischen 0 und 1023 liegen.",
"pins.analogWritePin|param|name": "PIN-Name, auf den geschrieben werden soll",
"pins.analogWritePin|param|value": "Wert, der auf den Pin geschrieben werden soll, zwischen ``0`` und ``1023`` z.B.: 1023,0",
"pins.createBuffer": "Erstellt einen Null-initialisierten Zwischenspeicher.",
"pins.createBuffer|param|size": "Anzahl der Bytes im Zwischenspeicher",
"pins.digitalReadPin": "Lese den angegebene Pin oder Verbinder als 0 oder 1",
"pins.digitalReadPin|param|name": "Pin, aus dem gelesen werden soll",
"pins.digitalWritePin": "Setzt einen Pin- oder Verbinder-Wert auf 0 oder 1.",
"pins.digitalWritePin|param|name": "Pin, auf den geschrieben werden soll",
"pins.digitalWritePin|param|value": "Wert, der auf dem Pin 1 gesetzt werden soll, z.B. 0",
"pins.i2cReadBuffer": "Lese `Größe`bytes aus einer 7-bit I2C-Adresse.",
"pins.i2cReadNumber": "Lese eine Nummer aus einer 7-bit I2C-Adresse.",
@@ -210,17 +175,12 @@
"pins.onPulsed": "Stellt diesen Pin als einen Digitaleingang ein und generiert Ereignisse, deren Zeitstempel die Dauer darstellt, in der der Pin entweder ``hoch``oder ``niedrig``war.",
"pins.pulseDuration": "Ruft die Dauer des letzten Impulses in Mikrosendungen ab. Diese Funktion soll von einem `onPulsed`-Handler aufgerufen werden.",
"pins.pulseIn": "Gibt die Dauer eines Pulses in Mikrosekunden an",
"pins.pulseIn|param|name": "der Pin, der den Puls misst",
"pins.pulseIn|param|value": "der Wert des Pulses (Standard hoch)",
"pins.servoSetPulse": "Konfiguriert diesen IO-Pin als einen analogen/PWM-Ausgang, stellt den Zeitraum auf 20 ms ein und setzt die Pulsweite fest, basieren auf dem angegeben Wert **Mikrosekunden** oder `1/1000`Millisekunden.",
"pins.servoSetPulse|param|micros": "Impulsdauer in Mikrosekunden, z.B.: 1500",
"pins.servoSetPulse|param|name": "PIN-Name",
"pins.servoWritePin": "Schreibt einen Wert in den Servo, der die Welle entsprechend kontroliert. Auf einem Standard-Servo wird so der Winkel der Welle (in Grad) eingestellt, sodass sich die Welle entsprechend anpasst. Auf einem kontinuierlich drehenden Servo wird dadurch die Geschwindigkeit des Servos festgelegt, wobei ``0``die volle Geschwindigkeit in eine Richtung darstellt, ``180``die volle Geschwindigkeit in die andere, und ein Wert von ``90`` einen Stillstand erzeugt.",
"pins.servoWritePin|param|name": "Pin, auf den geschrieben werden soll",
"pins.servoWritePin|param|value": "Winkel oder Rotationsbeschleunigung, z.B.: 180,90,0",
"pins.setPull": "Stellt die Anziehungskraft des Pins ein.",
"pins.setPull|param|name": "Pin, auf dem der Pull-Modus aktiviert wird",
"pins.setPull|param|pull": "eine der mbed-Pull-Konfigurationen: PullUp, PullDown, PullNone",
"pins.sizeOf": "Ruft die Bytegröße im spezifierten Nummernformat ab.",
"pins.spiWrite": "Schreibe in den SPI-Slave und gebe die Antwort aus",
"pins.spiWrite|param|value": "Daten, die an den SPI-Slave geschickt werden sollen",
@@ -231,8 +191,6 @@
"serial.readUntil": "Liest aus eine Textzeile aus dem seriellen Anschluss und gibt den Puffer aus, wenn die Begrenzung erreicht wurde.",
"serial.readUntil|param|delimiter": "Text-Begrenzung, die die Textblöcke voneinander trennt",
"serial.redirect": "Konfiguriert dynamisch die serielle Instanz, damit sie andere Pins als USBTX und USBRX benutzt.",
"serial.redirect|param|rx": "der neue Empfangs-Pin",
"serial.redirect|param|tx": "Der neue Übertragungs-Pin",
"serial.writeLine": "Gibt eine Zeile des Textes an die serielle",
"serial.writeNumber": "Gibt einen numerischen Wert an die serielle",
"serial.writeString": "Sendet ein Stück Text über serielle Verbindung.",

View File

@@ -7,12 +7,71 @@
"AcceleratorRange.OneG|block": "1g",
"AcceleratorRange.TwoG": "Der Bewegungssensor misst Kräfte bis 2g",
"AcceleratorRange.TwoG|block": "2g",
"BaudRate.BaudRate115200|block": "11520",
"BaudRate.BaudRate9600|block": "9600",
"BeatFraction.Eighth|block": "1/8",
"BeatFraction.Half|block": "1/2",
"BeatFraction.Quarter|block": "1/4",
"BeatFraction.Sixteenth|block": "1/16",
"BeatFraction.Whole|block": "1",
"Button.AB|block": "A+B",
"Delimiters.Dollar|block": "$",
"Delimiters.Hash|block": "#",
"Delimiters.NewLine|block": "Neue Zeile",
"Dimension.Strength|block": "Stärke",
"Dimension.X|block": "x",
"Dimension.Y|block": "y",
"Dimension.Z|block": "z",
"Direction.Left|block": "links",
"Direction.Right|block": "rechts",
"DisplayMode.BackAndWhite|block": "Schwarz-Weiß",
"DisplayMode.Greyscale|block": "Graustufen",
"EventCreationMode.CreateAndFire": "Calliope mini-Event wurde initialisiert, seine Event-Handler werden unverzüglich ausgeführt (nicht geeignet für die Nutzung bei Unterbrechungen!).",
"EventCreationMode.CreateOnly": "Calliope mini-Event wurde initialisiert, es wird keine weitere Verarbeitung vorgenommen.",
"Gesture.EightG|block": "8g",
"Gesture.FreeFall": "Wird ausgeführt, wenn das Board fällt!",
"Gesture.FreeFall|block": "freier Fall",
"Gesture.LogoDown": "Wird ausgeführt, wenn das Logo nach unten zeigt und das Display vertikal ist.",
"Gesture.LogoDown|block": "Logo nach unten",
"Gesture.LogoUp": "Wird ausgeführt, wenn das Logo nach oben zeigt und das Display vertikal ist.",
"Gesture.LogoUp|block": "Logo oben",
"Gesture.ScreenDown": "Wird ausgeführt, wenn das Display nach oben zeigt und das Board horizontal ist.",
"Gesture.ScreenDown|block": "Display nach unten",
"Gesture.ScreenUp": "Wird ausgeführt, wenn das Display nach unten zeigt und das Board horizontal ist.",
"Gesture.ScreenUp|block": "Display nach oben",
"Gesture.Shake": "Wird erhöht, wenn geschüttelt",
"Gesture.Shake|block": "geschüttelt",
"Gesture.SixG": "Wird ausgeführt, ein 6g starker Stoß erkannt wird",
"Gesture.SixG|block": "6g",
"Gesture.ThreeG": "Wird ausgeführt, ein 3g starker Stoß erkannt wird",
"Gesture.ThreeG|block": "3g",
"Gesture.TiltLeft": "Wird ausgeführt, wenn das Display nach links zeigt",
"Gesture.TiltLeft|block": "nach links neigen",
"Gesture.TiltRight": "Wird ausgeführt, wenn das Display nach rechts zeigt",
"Gesture.TiltRight|block": "nach rechts neigen",
"LedSpriteProperty.Blink|block": "blinken",
"LedSpriteProperty.Brightness|block": "Helligkeit",
"LedSpriteProperty.Direction|block": "Richtung",
"LedSpriteProperty.X|block": "x",
"LedSpriteProperty.Y|block": "y",
"Math.randomBoolean|block": "wähle zufälligen Wahr- oder Falsch-Wert",
"Math|block": "Mathematik",
"Note.CSharp3|block": "C#3",
"Note.CSharp4|block": "C#4",
"Note.CSharp5|block": "C#5",
"Note.CSharp|block": "C#",
"Note.FSharp3|block": "F#3",
"Note.FSharp4|block": "F#4",
"Note.FSharp5|block": "F#5",
"Note.FSharp|block": "F#",
"Note.GSharp3|block": "G#3",
"Note.GSharp4|block": "G#4",
"Note.GSharp5|block": "G#5",
"Note.GSharp|block": "G#",
"PinPullMode.PullDown|block": "nach unten",
"PinPullMode.PullUp|block": "nach oben",
"Rotation.Pitch|block": "Winkel",
"Rotation.Roll|block": "rollen",
"String.charAt|block": "Zeichen an Position %pos aus|%this",
"String.compare|block": "vergleiche %this| mit %that",
"String.concat|block": "hänge %this| mit %other aneinander",
@@ -23,10 +82,10 @@
"String|block": "Zeichenfolge",
"basic.clearScreen|block": "Bildschirminhalt löschen",
"basic.forever|block": "dauerhaft",
"basic.pause|block": "Pausiere (ms) %pause",
"basic.pause|block": "pausiere (ms) %pause",
"basic.showLeds|block": "zeige LEDs",
"basic.showNumber|block": "zeige|Nummer %number",
"basic.showString|block": "Zeige|Zeichenfolge %text",
"basic.showString|block": "zeige|Zeichenfolge %text",
"basic|block": "Grundlagen",
"control.deviceName|block": "Gerätename",
"control.deviceSerialNumber|block": "Seriennnummer",
@@ -56,7 +115,6 @@
"input.magneticForce|block": "Magnetkraft (µT) |%NAME",
"input.onButtonPressed|block": "wenn Knopf|%NAME|gedrückt",
"input.onGesture|block": "wenn |%NAME",
"input.onPinPressed|block": "wenn Pin %NAME|gedrückt",
"input.onPinReleased|block": "wenn Pin %NAME|losgelassen",
"input.pinIsPressed|block": "Pin %NAME|ist gedrückt",
"input.rotation|block": "Rotation (°)|%NAME",
@@ -71,7 +129,7 @@
"led.setBrightness|block": "Setze Helligkeit auf %value",
"led.stopAnimation|block": "Halte Animation an",
"led.toggle|block": "Schalte zwischen|x %x|y %y",
"led.unplot|block": "Unplot|x %x|y %y",
"led.unplot|block": "schalte Pixel|x %x|y %y aus",
"led|block": "LED",
"music.beat|block": "%fraction|Takt",
"music.changeTempoBy|block": "ändere die Geschwindigkeit (bpm)|%value",

View File

@@ -21,59 +21,40 @@
"basic.showString|param|text": "le texte à faire défiler sur lécran, par exemple : « Bonjour ! »",
"control.inBackground": "Planifie le code qui sexécute en arrière-plan.",
"control.reset": "Réinitialise le micro:bit de BBC.",
"control.waitMicros": "Bloque la fibre courante pour le nombre de microsecondes donné",
"control.waitMicros|param|micros": "nombre de microsecondes à attendre. par ex. : 4",
"game": "Un moteur de jeu avec une unique LED",
"game.addLife|param|lives": "TODO",
"game.addScore": "Ajoute des points au score actuel",
"game.addScore|param|points": "nombre de points à changer, par ex. : 1",
"game.gameOver": "Affiche un animation de fin de jeu.",
"game.removeLife|param|life": "TODO",
"game.score": "Obtient le score actuel",
"game.setLife|param|value": "TODO",
"game.setScore": "Définit la valeur du score actuel",
"game.setScore|param|value": "TODO",
"game.startCountdown": "Démarre un compte à rebours de jeu",
"game.startCountdown|param|ms": "durée du compte à rebours en millisecondes, par ex. : 10000",
"images": "Création, manipulation et affichage dimages LED.",
"images.createBigImage": "Crée une image à partir de 2 images.",
"images.createImage": "Crée une image qui sadapte aux dimensions de lécran LED.",
"input": "Événements et des données provenant de capteurs",
"input.acceleration|param|dimension": "TODO",
"input.acceleration": "Donne la valeur de l'accélération en milli-g (quand la carte est à plat avec l'écran vers le haut, x=0, y=0 et z=-1024)",
"input.buttonIsPressed": "Donne l'état du bouton (appuyé ou non) pour ``A`` et ``B``.",
"input.calibrate": "Obsolète, le calibrage de la boussole est automatique.",
"input.compassHeading": "Obtient la direction actuelle du compas en degrés.",
"input.magneticForce|param|dimension": "TODO",
"input.onButtonPressed|param|body": "TODO",
"input.onButtonPressed|param|button": "TODO",
"input.onGesture|param|body": "TODO",
"input.onLogoDown|param|body": "TODO",
"input.onLogoUp|param|body": "TODO",
"input.lightLevel": "Lit le niveau de lumière appliqué à l'écran LED de ``0`` (sombre) à ``255`` lumineux.",
"input.magneticForce": "Obtenir la valeur de la force magnétique en ``micro-Teslas`` (``µT``). Cette fonction nest pas supportée par le simulateur.",
"input.onButtonPressed": "Faire quelque chose quand un bouton (``A``, ``B`` ou les deux ``A+B``) est appuyé",
"input.onGesture": "Faire quelque chose lorsque lorsquun geste est fait (par exemple secouer le micro:bit).",
"input.onPinPressed": "Faire quelque chose lorsque vous appuyez sur une broche.",
"input.onPinPressed|param|body": "code à exécuter lorsque la broche est enfoncée",
"input.onPinPressed|param|name": "la broche qui doit être pressée",
"input.onPinReleased": "Faire quelque chose quand une broche est relâchée.",
"input.onPinReleased|param|body": "le code à exécuter lorsque la broche est relâchée",
"input.onPinReleased|param|name": "la broche qui doit être relâchée",
"input.onScreenDown|param|body": "TODO",
"input.onScreenUp|param|body": "TODO",
"input.onShake|param|body": "TODO",
"input.pinIsPressed|param|name": "broche utilisée pour détecter le contact",
"input.rotation|param|kind": "TODO",
"input.pinIsPressed": "Donne létat de la broche (pressée ou non). Nécessite de tenir la masse pour fermer le circuit.",
"input.runningTime": "Donne le nombre de millisecondes écoulées depuis la mise en route.",
"input.temperature": "Obtient la température en degrés Celsius (°C).",
"led": "Contrôle de lécran LED.",
"led.enable": "Active ou désactive laffichage",
"led.fadeIn|param|ms": "TODO",
"led.fadeOut|param|ms": "TODO",
"led.plotAll": "Allume toutes les LEDS",
"led.plotBarGraph|param|value": "valeur actuelle à tracer",
"led.plot|param|x": "TODO",
"led.plot|param|y": "TODO",
"led.point|param|x": "TODO",
"led.point|param|y": "TODO",
"led.setBrightness|param|value": "valeur de la luminosité, par ex. : 255, 127, 0",
"led.toggle|param|x": "TODO",
"led.toggle|param|y": "TODO",
"led.unplot|param|x": "TODO",
"led.unplot|param|y": "TODO",
"music.rest": "Repose (joue rien) pendant une durée spécifiée via broche '' P0''.",
"pins.analogPitch|param|frequency": "TODO",
"pins.analogPitch|param|ms": "TODO",

View File

@@ -30,7 +30,6 @@
"input.magneticForce|block": "force magnétique (µT) |%NAME",
"input.onButtonPressed|block": "lorsque le button|%NAME|est pressé",
"input.onGesture|block": "lorsque|%NAME",
"input.onPinPressed|block": "lorsque le pin %NAME|est pressé",
"input.onPinReleased|block": "lorsque la broche %NAME|est lachée",
"input.pinIsPressed|block": "broche %NAME| est pressée",
"input.rotation|block": "rotation (°)|%NAME",

View File

@@ -0,0 +1,82 @@
{
"AcceleratorRange.EightG": "8Gまでの加速度を測ります。",
"AcceleratorRange.EightG|block": "8G",
"AcceleratorRange.FourG": "4Gまでの加速度を測ります。",
"AcceleratorRange.FourG|block": "4G",
"AcceleratorRange.OneG": "1Gまでの加速度を測ります。",
"AcceleratorRange.OneG|block": "1G",
"AcceleratorRange.TwoG": "2Gまでの加速度を測ります。",
"AcceleratorRange.TwoG|block": "2G",
"BaudRate.BaudRate115200|block": "115200",
"BaudRate.BaudRate9600|block": "9600",
"BeatFraction.Breve|block": "4",
"BeatFraction.Double|block": "2",
"BeatFraction.Eighth|block": "1/8",
"BeatFraction.Half|block": "1/2",
"BeatFraction.Quarter|block": "1/4",
"BeatFraction.Sixteenth|block": "1/16",
"BeatFraction.Whole|block": "1",
"Button.AB|block": "A+B",
"Delimiters.Dollar|block": "$",
"Delimiters.Hash|block": "#",
"Delimiters.NewLine|block": "改行",
"Gesture.EightG": "8Gの衝撃があったときに発生します。",
"Gesture.EightG|block": "8G",
"Gesture.FreeFall": "ボードを落としたときに発生します。",
"Gesture.FreeFall|block": "落とした",
"Gesture.LogoDown": "画面が垂直で、ロゴの位置が下になったときに発生します。",
"Gesture.LogoDown|block": "ロゴが下になった",
"Gesture.LogoUp": "画面が垂直で、ロゴの位置が上になったときに発生します。",
"Gesture.LogoUp|block": "ロゴが上になった",
"Gesture.ScreenDown": "ボードが水平で、画面が下向きになったときに発生します。",
"Gesture.ScreenDown|block": "画面が下になった",
"Gesture.ScreenUp": "ボードが水平で、画面が上向きになったときに発生します。",
"Gesture.ScreenUp|block": "画面が上になった",
"Gesture.Shake": "ボードがゆさぶられたときに発生します。",
"Gesture.Shake|block": "ゆさぶられた",
"Gesture.SixG": "6Gの衝撃があったときに発生します。",
"Gesture.SixG|block": "6G",
"Gesture.ThreeG": "3Gの衝撃があったときに発生します。",
"Gesture.ThreeG|block": "3G",
"Gesture.TiltLeft": "画面を左に傾けたときに発生します。",
"Gesture.TiltLeft|block": "左に傾けた",
"Gesture.TiltRight": "画面を右に傾けたときに発生します。",
"Gesture.TiltRight|block": "右に傾けた",
"LedSpriteProperty.Brightness|block": "明るさ",
"Math.randomBoolean|block": "真または偽をランダムに選ぶ",
"Math|block": "計算",
"String.fromCharCode|block": "文字コード %code|の文字",
"basic.clearScreen|block": "表示を消す",
"basic.forever|block": "ずっと",
"basic.pause|block": "ひと休み(ミリ秒) %pause",
"basic.showLeds|block": "LEDに表示",
"basic.showNumber|block": "数を表示|%number",
"basic.showString|block": "文字列を表示|%text",
"basic|block": "基本",
"control.inBackground|block": "バックグラウンドで実行する",
"control.reset|block": "リセット",
"control|block": "制御",
"game.gameOver|block": "ゲームオーバー",
"game|block": "ゲーム",
"images.createBigImage|block": "大きな画像を作成",
"images.createImage|block": "画像を作成",
"images|block": "画像",
"input.acceleration|block": "加速度ミリG|%NAME",
"input.onPinPressed|block": "端子 %name|がタッチされたとき",
"input.onPinReleased|block": "端子 %NAME|がタッチされなくなったとき",
"input.pinIsPressed|block": "端子 %NAME|がタッチされている",
"input.rotation|block": "傾斜(°)|%NAME",
"input.runningTime|block": "稼働時間(ミリ秒)",
"input.setAccelerometerRange|block": "加速度センサの計測範囲を設定する %range",
"input.temperature|block": "温度(℃)",
"led.brightness|block": "明るさ",
"led.enable|block": "表示をオンまたはオフにする %on",
"led.plot|block": "点灯|x %x|y %y",
"led|block": "LED",
"music.setTempo|block": "テンポを設定するbpm|%value",
"music.tempo|block": "テンポbpm",
"music|block": "音楽",
"{id:category}Basic": "基本",
"{id:category}Led": "LED",
"{id:category}Math": "計算"
}

View File

@@ -0,0 +1,9 @@
{
"Math.abs": "Gir absoluttverdien av et tall (størrelsen av tallet, uavhengig av om det er positivt eller negativt).\nFor eksempel er absoluttverdien av -5 og absoluttverdien av 5 begge lik 5.",
"Math.abs|param|x": "Et tall eller matematisk uttrykk som vi ønsker absoluttverdien av.",
"Math.max": "Gir verdien til det største av to tall eller matematiske uttrykk.",
"Math.randomBoolean": "Gir en tilfeldig logisk verdi, \"sann\" eller \"usann\".",
"String.fromCharCode": "Lag en tekst som består av tegnet med den angitte ASCII-koden.",
"basic": "Blokker for grunnleggende mikro:bit-funksjonalitet.",
"basic.clearScreen": "Slå av alle lysene på skjermen"
}

View File

@@ -0,0 +1,3 @@
{
"serial|block": "føljetong"
}

View File

@@ -0,0 +1,5 @@
{
"Math.abs": "Returnerar absolutbeloppet av ett tal (värdet utan hänsyn till huruvida det är positivt eller negativt). \nTill exempel är absolutbeloppet av -5 detsamma som absolutbeloppet av 5.",
"Math.max": "Returnerar det större av två givna numeriska uttryck.",
"Math.min": "Returnerar det mindre av två givna numeriska uttryck."
}

View File

@@ -21,7 +21,12 @@ namespace String_ {
//%
int compare(StringData *s, StringData *that) {
return strcmp(s->data, that->data);
int compareResult = strcmp(s->data, that->data);
if (compareResult < 0)
return -1;
else if (compareResult > 0)
return 1;
return 0;
}
//%
@@ -76,7 +81,7 @@ namespace Boolean_ {
}
//%
bool bang(bool v) { return !v; }
bool bang(int v) { return v == 0; }
}
namespace Number_ {

View File

@@ -150,15 +150,9 @@ namespace pxt {
if (i < length)
{
if (data[i] != Segment::MissingValue)
{
return data[i];
}
error(ERR_MISSING_VALUE);
return 0;
}
error(ERR_OUT_OF_BOUNDS);
return 0;
return Segment::DefaultValue;
}
void Segment::set(uint32_t i, uint32_t value)
@@ -223,12 +217,8 @@ namespace pxt {
{
memcpy(tmp, data, size * sizeof(uint32_t));
}
//fill the rest with missing values;
for(uint16_t i = size; i < newSize; i++)
{
tmp[i] = Segment::MissingValue;
}
//fill the rest with default value
memset(tmp + size, Segment::DefaultValue, (newSize - size) * sizeof(uint32_t));
//free older segment;
::operator delete(data);
@@ -280,12 +270,11 @@ namespace pxt {
if (length > 0)
{
uint32_t value = data[length];
data[length] = Segment::MissingValue;
data[length] = Segment::DefaultValue;
--length;
return value;
}
error(ERR_OUT_OF_BOUNDS);
return 0;
return Segment::DefaultValue;
}
//this function removes an element at index i and shifts the rest of the elements to
@@ -306,15 +295,14 @@ namespace pxt {
memmove(data + i, data + i + 1, (length - i - 1) * sizeof(uint32_t));
}
length--;
data[length] = Segment::MissingValue;
data[length] = Segment::DefaultValue;
#ifdef DEBUG_BUILD
printf("After Segment::remove index:%u\n", i);
this->print();
#endif
return ret;
}
error(ERR_OUT_OF_BOUNDS);
return 0;
return Segment::DefaultValue;
}
//this function inserts element value at index i by shifting the rest of the elements right.
@@ -350,42 +338,23 @@ namespace pxt {
void Segment::print()
{
printf("Segment: %x, length: %u, size: %u\n", data, (uint)length, (uint)size);
for(uint i = 0; i < size; i++)
printf("Segment: %x, length: %u, size: %u\n", data, (uint32_t)length, (uint32_t)size);
for(uint32_t i = 0; i < size; i++)
{
printf("%d ",(uint)data[i]);
printf("%d ",(uint32_t)data[i]);
}
printf("\n");
}
bool Segment::isValidIndex(uint32_t i)
{
if (i > length || data[i] == Segment::MissingValue)
if (i > length)
{
return false;
}
return true;
}
bool Segment::getNextValidIndex(uint32_t i, uint32_t *result)
{
while (i < length)
{
if (data[i] != Segment::MissingValue)
{
*result = i;
#ifdef DEBUG_BUILD
printf("In Segment::getNextValidIndex result=%u\n",i);
this->print();
#endif
return true;
}
i++;
}
return false;
}
void Segment::destroy()
{
#ifdef DEBUG_BUILD
@@ -415,29 +384,16 @@ namespace pxt {
uint32_t RefCollection::getAt(int i)
{
if (head.isValidIndex(i))
uint32_t tmp = head.get(i);
if (isRef())
{
uint32_t tmp = head.get(i);
if (isRef())
{
incr(tmp);
}
return tmp;
}
else
{
error(ERR_OUT_OF_BOUNDS);
return 0;
incr(tmp);
}
return tmp;
}
uint32_t RefCollection::removeAt(int i)
{
if (!head.isValidIndex((uint32_t)i))
{
error(ERR_OUT_OF_BOUNDS);
return 0;
}
if (isRef())
{
decr(head.get(i));
@@ -447,18 +403,11 @@ namespace pxt {
void RefCollection::insertAt(int i, uint32_t value)
{
if (i < length())
head.insert(i, value);
if (isRef())
{
head.insert(i, value);
if (isRef())
{
incr(value);
}
}
else
{
error(ERR_OUT_OF_BOUNDS);
}
incr(value);
}
}
void RefCollection::setAt(int i, uint32_t value)
@@ -480,26 +429,31 @@ namespace pxt {
{
StringData *xx = (StringData*)x;
uint32_t i = start;
while(head.getNextValidIndex(start, &i))
while(head.isValidIndex(i))
{
StringData *ee = (StringData*)head.get(i);
if (xx->len == ee->len && memcmp(xx->data, ee->data, xx->len) == 0)
if (ee == xx)
{
//handles ee being null
return (int) i;
}
if (ee && xx->len == ee->len && memcmp(xx->data, ee->data, xx->len) == 0)
{
return (int)i;
}
start = i;
i++;
}
}
else
{
uint32_t i = start;
while(head.getNextValidIndex(start, &i))
while(head.isValidIndex(i))
{
if (head.get(i) == x)
{
return (int)i;
}
start = i;
i++;
}
}
@@ -550,12 +504,9 @@ namespace pxt {
{
if (this->isRef())
{
uint32_t start = 0;
uint32_t i = 0;
while(head.getNextValidIndex(start, &i))
for(uint32_t i = 0; i < this->head.getLength(); i++)
{
decr(this->head.get(i));
start = i;
}
}
this->head.destroy();

View File

@@ -38,7 +38,6 @@ namespace pxt {
ERR_OUT_OF_BOUNDS = 8,
ERR_REF_DELETED = 7,
ERR_SIZE = 9,
ERR_MISSING_VALUE = 10,
} ERROR;
extern const uint32_t functionsAndBytecode[];
@@ -175,7 +174,7 @@ namespace pxt {
uint16_t size;
static const uint16_t MaxSize = 0xFFFF;
static const uint32_t MissingValue = 0x80000000;
static const uint32_t DefaultValue = 0x0;
static uint16_t growthFactor(uint16_t size);
void growByMin(uint16_t minSize);
@@ -197,10 +196,6 @@ namespace pxt {
uint32_t remove(uint32_t i);
void insert(uint32_t i, uint32_t value);
//Returns true if there is a valid index greater than or equal to 'i', returns false otherwise
//If 'i' is valid returns it in 'result', if not tries to find the next valid
//index < length which is valid.
bool getNextValidIndex(uint32_t i, uint32_t *result);
bool isValidIndex(uint32_t i);
void destroy();

View File

@@ -37,7 +37,11 @@
"_locales/fr/core-jsdoc-strings.json",
"_locales/fr/core-strings.json",
"_locales/de/core-jsdoc-strings.json",
"_locales/de/core-strings.json"
"_locales/de/core-strings.json",
"_locales/no/core-strings.json",
"_locales/ja/core-strings.json",
"_locales/sv-SE/core-jsdoc-strings.json",
"_locales/no/core-jsdoc-strings.json"
],
"public": true,
"dependencies": {},
@@ -50,4 +54,4 @@
}
}
}
}
}

View File

@@ -51,24 +51,27 @@ namespace serial {
}
/**
* Reads a line of text from the serial port.
*/
//% help=serial/read-line
//% blockId=serial_read_line block="serial|read line"
//% weight=20 blockGap=8
StringData* readLine() {
return readUntil(ManagedString("\n").leakData());
* Reads the buffered received data as a string
*/
//% blockId=serial_read_buffer block="serial|read string"
//% weight=18
StringData* readString() {
int n = uBit.serial.getRxBufferSize();
if (n == 0) return ManagedString("").leakData();
return ManagedString(uBit.serial.read(n, MicroBitSerialMode::ASYNC)).leakData();
}
/**
* Registers an event to be fired when one of the delimiter is matched
* @param delimiters the characters to match received characters against. eg:"\n"
* Registers an event to be fired when one of the delimiter is matched.
* @param delimiters the characters to match received characters against.
*/
// help=serial/on-data-received
// weight=18
//% help=serial/on-data-received
//% weight=18 blockId=serial_on_data_received block="serial|on data received %delimiters=serial_delimiter_conv"
void onDataReceived(StringData* delimiters, Action body) {
uBit.serial.eventOn(ManagedString(delimiters));
registerWithDal(MICROBIT_ID_SERIAL, MICROBIT_SERIAL_EVT_DELIM_MATCH, body);
// lazy initialization of serial buffers
uBit.serial.read(MicroBitSerialMode::ASYNC);
}
/**

View File

@@ -38,20 +38,20 @@ namespace serial {
}
/**
* Registers an event to be fired when a line has been received
*/
// help=serial/on-line-received
// blockId=serial_on_line_received block="serial on line received"
// weight=21 blockGap=8
export function onLineReceived(body: Action): void {
// serial.onDataReceived("\n", body);
* Reads a line of text from the serial port.
*/
//% help=serial/read-line
//% blockId=serial_read_line block="serial|read line"
//% weight=20 blockGap=8
export function readLine(): string {
return serial.readUntil(delimiters(Delimiters.NewLine));
}
/**
* Returns the delimiter corresponding string
*/
//% blockId="serial_delimiter_conv" block="%del"
//% weight=1
//% weight=1 blockHidden=true
export function delimiters(del: Delimiters): string {
// even though it might not look like, this is more
// (memory) efficient than the C++ implementation, because the

17
libs/core/shims.d.ts vendored
View File

@@ -672,12 +672,19 @@ declare namespace serial {
function readUntil(delimiter: string): string;
/**
* Reads a line of text from the serial port.
* Reads the buffered received data as a string
*/
//% help=serial/read-line
//% blockId=serial_read_line block="serial|read line"
//% weight=20 blockGap=8 shim=serial::readLine
function readLine(): string;
//% blockId=serial_read_buffer block="serial|read string"
//% weight=18 shim=serial::readString
function readString(): string;
/**
* Registers an event to be fired when one of the delimiter is matched.
* @param delimiters the characters to match received characters against.
*/
//% help=serial/on-data-received
//% weight=18 blockId=serial_on_data_received block="serial|on data received %delimiters=serial_delimiter_conv" shim=serial::onDataReceived
function onDataReceived(delimiters: string, body: () => void): void;
/**
* Sends a piece of text through Serial connection.

View File

@@ -0,0 +1,3 @@
{
"devices": "Contrôler un téléphone avec le BBC micro : bit via Bluetooth."
}

View File

@@ -5,7 +5,8 @@
"README.md",
"enums.d.ts",
"shims.d.ts",
"devices.cpp"
"devices.cpp",
"_locales/fr/devices-jsdoc-strings.json"
],
"public": true,
"dependencies": {
@@ -13,4 +14,4 @@
"bluetooth": "file:../bluetooth"
},
"installedVersion": "ljipgq"
}
}

View File

@@ -0,0 +1,24 @@
{
"radio": "Daten mithilfe von Funk-Paketen übertragen",
"radio.onDataPacketReceived": "Registriert Funktionen, die ausgeführt werden, wenn das Radio ein Datenpaket empfängt. Entnimmt das empfangene Paket aus der Warteschlange des Radios.",
"radio.onDataReceived": "Registriert Code der ausgeführt wird, wenn ein Paket über Funk empfangen wird.",
"radio.receiveNumber": "Liest das nächste Paket aus der Funk-Warteschlange und gibt die Paketnummer oder 0 aus, wenn das Paket keine Nummer enthält.",
"radio.receiveString": "Liest das nächste Paket aus der Funk-Warteschlange und gibt die enthaltene Zeichenfolge oder die leere Zeichenfolge aus, wenn das Paket keine Zeichenfolge enthält.",
"radio.receivedNumber": "Extrahiert eine Zahl aus dem Inhalt des letzten Datenpakets, welches aus der Warteschlange des Radios (via ``Zahl empfangen``, ``Zeichenkette empfangen``, etc) entnommen wurde oder eine 0, wenn das Paket keine Zahl enthält.",
"radio.receivedSerial": "Extrahiert die Seriennummer des Calliope mini Senders aus dem Inhalt des letzten Datenpakets, welches aus der Warteschlange des Radios entnommen wurde oder eine 0, wenn der Absender keine Seriennummer gesendet hat.",
"radio.receivedSignalStrength": "Ruft den empfangenen Signalstärkeindikator (RSSI) aus dem letzten Paket aus der Funk-Warteschlange aus (via ``receiveNumber``, ``receiveString``, etc). Wird im Simulator nicht unterstützt.\nnamespace=radio",
"radio.receivedString": "Extrahiert die Zeichenkette aus dem Inhalt des letzten Datenpakets, welches aus der Warteschlange des Radios (via ``Zahl empfangen``, ``Zeichenkette empfangen``, etc) entnommen wurde oder eine leere Zeichenkette, wenn das Paket keine Zeichenkette enthält.",
"radio.receivedTime": "Extrahiert die Systemzeit des Absenders aus dem Inhalt des letzten Datenpakets, welches aus der Warteschlange des Radios (via ``Zahl empfangen``, ``Zeichenkette empfangen``, etc) entnommen wurde.",
"radio.sendNumber": "Überträgt eine Nummer über Funk an jeden angeschlossenen mini in der Gruppe.",
"radio.sendString": "Überträgt eine Zeichenfolge über Funk mit Seriennummer des Geräts und Laufzeit an jeden angeschlossenen mini in der Gruppe.",
"radio.sendValue": "Sendet ein Name / Wert-Paar zusammen mit der Seriennummer des Geräts und die Laufzeit auf alle angeschlossenen minis in der Gruppe.",
"radio.sendValue|param|name": "die Feldnamen (max. 12 Zeichen), z.B.: \"Daten\"",
"radio.sendValue|param|value": "der numerische Wert",
"radio.setGroup": "Setzt die Gruppen-ID für Funkverbindungen. Ein mini kann nur ein Gruppen-ID hören.\nDie Gruppen-ID zwischen liegt zwischen 0 und 255, z.B. 1",
"radio.setTransmitPower": "Ändere die Ausgabeleistung des Senders auf den angegebenen Wert.",
"radio.setTransmitPower|param|power": "ein Wert im Bereich 0.. 7, wo 0 die niedrigste Leistung und 7 ist ist die höchste. z.B. 7",
"radio.setTransmitSerialNumber": "Stelle den Dunk so ein, dass die Seriennummer in jeder Nachricht übertragen wird.",
"radio.setTransmitSerialNumber|param|transmit": "Wert, der anzeigt, ob die Seriennummer übertragen wird, z.B. wahr",
"radio.writeReceivedPacketToSerial": "Schreibt das letzte empfangene Paket als JSON auf Seriell. Sollte in einem ´´onDataPacketReceived``-Callback aufgerufen werden.",
"radio.writeValueToSerial": "Liest das nächste Paket aus der Funk-Warteschlange und schreibt dieses als JSON auf Seriell."
}

View File

@@ -0,0 +1,17 @@
{
"radio.onDataPacketReceived|block": "wenn Datenpaket empfangen",
"radio.onDataReceived|block": "über Funk empfangene Daten",
"radio.receiveNumber|block": "über Funk empfangene Zahl",
"radio.receiveString|block": "über Funk empfangene Zeichenfolge",
"radio.receivedSignalStrength|block": "über Funk empfangene Signalstärke",
"radio.sendNumber|block": "sende Zahl %value über Funk",
"radio.sendString|block": "sende Zeichenfolge %msg über Funk",
"radio.sendValue|block": "schicke | Wert %name |=%value über Funk",
"radio.setGroup|block": "setze Gruppe %ID über Funk",
"radio.setTransmitPower|block": "lege Übertragungsstärke %power über Funk fest",
"radio.setTransmitSerialNumber|block": "übertrage Übertragungs-Seriennummer %transmit über Funk",
"radio.writeReceivedPacketToSerial|block": "schreibe das über Funk emfangene Paket auf Seriell",
"radio.writeValueToSerial|block": "schreibe Wert auf Seriell über Funk",
"radio|block": "Funk",
"{id:category}Radio": "Funk"
}

View File

@@ -6,7 +6,9 @@
"shims.d.ts",
"enums.d.ts",
"radio.cpp",
"radio.ts"
"radio.ts",
"_locales/de/radio-strings.json",
"_locales/de/radio-jsdoc-strings.json"
],
"public": true,
"dependencies": {

View File

@@ -24,7 +24,7 @@ using namespace pxt;
// payload: string length (9), string (10 ... 28)
#define PACKET_TYPE_STRING 2
//% color=270 weight=34 icon="\uf012"
//% color=270 weight=96 icon="\uf012"
namespace radio {
// -------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
/**
* Communicate data using radio packets
*/
//% color=#E3008C weight=34 icon="\uf012"
//% color=#E3008C weight=96 icon="\uf012"
namespace radio {
export class Packet {
/**

View File

@@ -2,7 +2,7 @@
//% color=270 weight=34 icon="\uf012"
//% color=270 weight=96 icon="\uf012"
declare namespace radio {
/**

View File

@@ -1,6 +1,6 @@
{
"name": "pxt-microbit",
"version": "0.7.18",
"version": "0.7.48",
"description": "micro:bit target for PXT",
"keywords": [
"JavaScript",
@@ -21,10 +21,12 @@
"built/*.json",
"built/*.d.ts",
"built/hexcache",
"built/web",
"sim/public",
"docs/*.md",
"docs/*/*.md",
"docs/*/*/*.md"
"docs/*/*/*.md",
"docs/static/icons/favicon.ico"
],
"main": "built/pxtrequire.js",
"typings": "built/pxtrequire.d.ts",
@@ -34,6 +36,6 @@
"semantic-ui-less": "^2.2.4"
},
"dependencies": {
"pxt-core": "0.8.6"
"pxt-core": "0.11.4"
}
}

View File

@@ -28,6 +28,7 @@
"deployDrives": "(MICROBIT|MBED)",
"driveName": "MICROBIT",
"hexMimeType": "application/x-microbit-hex",
"openocdScript": "source [find interface/cmsis-dap.cfg]; source [find target/nrf51.cfg]",
"upgrades": [
{
"type": "package",
@@ -72,7 +73,8 @@
"logicBlocks": true,
"variablesBlocks": true,
"onStartColor": "#0078D7",
"onStartNamespace": "basic"
"onStartNamespace": "basic",
"onStartWeight": 54
},
"simulator": {
"autoRun": true,
@@ -240,10 +242,6 @@
"name": "Support",
"path": "https://support.microbit.org/"
},
{
"name": "Getting Started",
"path": "/getting-started"
},
{
"name": "Projects",
"path": "/projects"
@@ -332,6 +330,7 @@
"invertedMenu": true,
"coloredToolbox": true,
"monacoToolbox": true,
"hasAudio": true,
"blocklyOptions": {
"grid": {
"spacing": 45,
@@ -341,4 +340,4 @@
}
}
}
}
}

View File

@@ -14,7 +14,6 @@ namespace pxsim {
radioState: RadioState;
// TODO: not singletons
neopixelState: NeoPixelState;
servosState: MicroServosState;
fileSystem: FileSystemState;
constructor() {
@@ -53,7 +52,13 @@ namespace pxsim {
0,
DAL.MICROBIT_ID_IO_P19,
DAL.MICROBIT_ID_IO_P20
]
],
servos: {
"P0": DAL.MICROBIT_ID_IO_P0,
"P1": DAL.MICROBIT_ID_IO_P1,
"P2": DAL.MICROBIT_ID_IO_P2,
"P3": DAL.MICROBIT_ID_IO_P3
}
});
this.builtinParts["radio"] = this.radioState = new RadioState(runtime);
this.builtinParts["accelerometer"] = this.accelerometerState = new AccelerometerState(runtime);
@@ -62,12 +67,7 @@ namespace pxsim {
this.builtinParts["lightsensor"] = this.lightSensorState = new LightSensorState();
this.builtinParts["compass"] = this.compassState = new CompassState();
this.builtinParts["neopixel"] = this.neopixelState = new NeoPixelState();
this.builtinParts["microservo"] = this.servosState = new MicroServosState({
"P0": DAL.MICROBIT_ID_IO_P0,
"P1": DAL.MICROBIT_ID_IO_P1,
"P2": DAL.MICROBIT_ID_IO_P2,
"P3": DAL.MICROBIT_ID_IO_P3
});
this.builtinParts["microservo"] = this.edgeConnectorState;
this.builtinVisuals["buttonpair"] = () => new visuals.ButtonPairView();
this.builtinVisuals["ledmatrix"] = () => new visuals.LedMatrixView();

View File

@@ -76,8 +76,7 @@ namespace pxsim.pins {
if (!pin) return;
analogSetPeriod(pinId, 20000);
const state = board().servosState.servoState(pinId);
state.setAngle(value);
pin.servoAngle = value;
}
export function servoSetPulse(pinId: number, micros: number) {

View File

@@ -28,7 +28,7 @@ namespace pxsim {
this.data = data;
}
public print() {
console.log(`Image id:${this.id} refs:${this.refcnt} size:${this.width}x${Image.height}`)
// console.debug(`Image id:${this.id} refs:${this.refcnt} size:${this.width}x${Image.height}`)
}
public get(x: number, y: number): number {
if (x < 0 || x >= this.width || y < 0 || y >= 5) return 0;
@@ -53,9 +53,9 @@ namespace pxsim {
}
public shiftRight(cols: number) {
for (let x = this.width - 1; x <= 0; --x)
for (let x = this.width - 1; x >= 0; --x)
for (let y = 0; y < 5; ++y)
this.set(x, y, x > cols ? this.get(x - cols, y) : 0);
this.set(x, y, x >= cols ? this.get(x - cols, y) : 0);
}
public clear(): void {
@@ -195,11 +195,16 @@ namespace pxsim.ImageMethods {
board().ledMatrixState.animationQ.enqueue({
interval: interval,
frame: () => {
//TODO: support right to left.
if (off >= leds.width || off < 0) return false;
stride > 0 ? display.shiftLeft(stride) : display.shiftRight(-stride);
let c = Math.min(stride, leds.width - off);
leds.copyTo(off, c, display, 5 - stride)
if (stride > 0) {
display.shiftLeft(stride);
const c = Math.min(stride, leds.width - off);
leds.copyTo(off, c, display, 5 - stride)
} else {
display.shiftRight(-stride);
const c = Math.min(-stride, leds.width - off);
leds.copyTo(off, c, display, 0)
}
off += stride;
return true;
},
@@ -223,7 +228,7 @@ namespace pxsim.basic {
clearScreen();
pause(interval * 5);
} else {
if (s.length == 1) showLeds(createImageFromString(s + " "), interval * 5)
if (s.length == 1) showLeds(createImageFromString(s), 0);
else ImageMethods.scrollImage(createImageFromString(s + " "), 1, interval);
}
}

View File

@@ -35,18 +35,14 @@ namespace pxsim.serial {
board().writeSerial(s);
}
export function readUntil(del: string): string {
return readString();
}
export function readString(): string {
return board().serialState.readSerial();
}
export function readLine(): string {
return board().serialState.readSerial();
}
export function readUntil(del: string): string {
return readLine();
}
export function onDataReceived(delimiters: string, handler: RefAction) {
let b = board();
b.bus.listen(DAL.MICROBIT_ID_SERIAL, DAL.MICROBIT_SERIAL_EVT_DELIM_MATCH, handler);

View File

@@ -179,6 +179,7 @@ namespace pxsim.visuals {
.sim-neopixel-canvas-parent:hover {
transform-origin: center;
transform: scale(4) translateY(-60px);
-moz-transform: scale(4) translateY(-220px);
}
.sim-neopixel-canvas .hidden {
visibility:hidden;

View File

@@ -5,7 +5,8 @@
"microbit-foundation"
],
"approvedRepos": [
"CoderDojoOlney/pxt-olney"
"CoderDojoOlney/pxt-olney",
"PaulDFoster/pxt-microbit-GY521"
]
}
}

View File

@@ -16,6 +16,7 @@
@red: #EF767A;
@pink: #F46197;
@yellow: #FDE74C;
@grey:#95a5a6;
/* Microbit.org colors */
@orange: #ff8b27;
@@ -35,9 +36,6 @@
@mainMenuInvertedBackground: @blue;
@mainMenuTutorialBackground: @orange;
@mainMenuHeight: 5rem;
@mobileMenuHeight: 4.4rem;
@mainMenuBlocksJsToggleColor: @primaryColor;
@tutorialSelectedMenuColor: @blue;
@@ -55,6 +53,7 @@
--------------------*/
@simulatorBackground: #FDFDFF;
@editorToolsBackground: @simulatorBackground;
@blocklySvgColor: #ecf0f1;
/*-------------------

View File

@@ -1,5 +1,5 @@
/* Import all components */
@import 'semantic';
@import 'pxtsemantic';
@import 'pxt';
@import 'themes/default/globals/site.variables';
@import 'themes/pxt/globals/site.variables';
@@ -12,16 +12,11 @@
Add your custom CSS here
*******************************/
.download-button {
&:extend(.ui.button all);
.ui.button.download-button {
&:extend(.purple all);
}
.download-button.download-button-full {
&:extend(.ui.inverted.purple.button all);
}
.download-button:hover {
.ui.button.download-button:hover {
&:extend(.green all);
color: black !important;
}
@@ -30,20 +25,27 @@
&:extend(.ui.inverted.button all);
}
.getting-started-btn {
&:extend(.ui.button all);
.ui.button.getting-started-btn {
&:extend(.orange all);
}
#filelist {
.ui.button.editortools-btn {
&:extend(.blue all);
}
#filelist, #editortools {
background: #fff url(https://az742082.vo.msecnd.net/pub/psopafpj) 0 0 repeat !important;
}
#downloadArea {
background: transparent !important;
}
/*******************************
Blockly
*******************************/
.blocklyTreeRow {
div.blocklyTreeRow {
border-bottom: 1px solid #ecf0f1 !important;
margin-bottom: 0px !important;
@@ -54,7 +56,7 @@
}
/* Blockly toolbox font size same as the page font */
.blocklyTreeLabel {
span.blocklyTreeLabel {
font-family: @pageFont !important;
font-weight: 200;
}
@@ -62,12 +64,11 @@
.blocklyToolboxDiv, .monacoToolboxDiv {
background-color: white !important;
border-left: 1px solid #ecf0f1 !important;
box-shadow: 0px 0px 2px 0px rgba(0,0,0,0.12), 0px 2px 2px 0px rgba(0,0,0,0.24);
box-shadow: 0px 0px 2px 0px rgba(0,0,0,0.12), 0px 0px 2px 0px rgba(0,0,0,0.24);
}
.blocklyFlyoutBackground {
fill: #525A67 !important;
fill-opacity: 0.5 !important;
}
/* Remove shadow around blockly blocks */
@@ -80,14 +81,8 @@
}
/* Blockly Toolbox Buttons */
.blocklyToolboxButtons .blocklyAddPackageButton {
&:extend(.ui.inverted.pink.button all);
&:extend(.ui.circular.button all);
}
.blocklyToolboxButtons .blocklyUndoButton {
&:extend(.ui.inverted.blue.button all);
&:extend(.ui.circular.button all);
.ui.button.blocklyAddPackageButton {
&:extend(.pink all);
}
/*******************************
@@ -121,6 +116,9 @@
/* Tablet */
@media only screen and (min-width: @tabletBreakpoint) and (max-width: @largestTabletScreen) {
#filelist {
background: transparent !important;
}
}
/* Small Monitor */

View File

@@ -32,7 +32,7 @@
@input : 'pxt';
@label : 'pxt';
@list : 'pxt';
@loader : 'pulsar';
@loader : 'pxt';
@rail : 'pxt';
@reveal : 'pxt';
@segment : 'pxt';