Compare commits

...

60 Commits

Author SHA1 Message Date
fd06fae050 0.3.23 2016-08-11 15:05:30 -07:00
7fbb056edf Bump pxt-core to 0.3.26 2016-08-11 15:05:29 -07:00
06758863fb 0.3.22 2016-08-11 14:38:08 -07:00
ad8af16a5a 0.3.21 2016-08-11 14:15:02 -07:00
70dd6bcac5 Bump pxt-core to 0.3.25 2016-08-11 14:14:59 -07:00
b103423a53 0.3.20 2016-08-11 12:11:04 -07:00
a82a44e587 Bump pxt-core to 0.3.23 2016-08-11 12:11:02 -07:00
e6f612283f remove dead page 2016-08-11 11:41:59 -07:00
fcd60876ab Removing streaming menu dialog 2016-08-11 11:41:07 -07:00
5daa9a0bb6 broken links 2016-08-11 10:44:17 -07:00
4fb3926073 fix snippets 2016-08-11 10:40:48 -07:00
73932f4619 0.3.19 2016-08-10 23:27:46 -07:00
c99138b02e adding SPI support 2016-08-10 23:26:58 -07:00
64d584681a docs tweaks 2016-08-10 16:09:57 -07:00
9788dd49cc fix testsnippet crash 2016-08-10 14:06:26 -07:00
9d15c4e270 fixing docs issues 2016-08-10 13:46:11 -07:00
fe7b06d763 0.3.18 2016-08-10 13:12:26 -07:00
0e0275e496 doc fixes 2016-08-10 13:10:40 -07:00
ffd4d96539 properly escape values in json payload 2016-08-10 09:28:22 -07:00
a6b4c9645a Merge pull request #199 from Microsoft/ignore-snippets
-ignore snippet notation
2016-08-10 08:29:05 -07:00
a9141d027f Add package info for server side check 2016-08-10 13:44:10 +01:00
807e581c3d Addition of ignore notation
Some snippets are designed to show syntax errors or refer to earlier variables. In this case the automated checker needs to avoid compiling them
2016-08-10 13:43:48 +01:00
41a4dfeb68 Documentation snippet fixes 2016-08-10 10:51:55 +01:00
4430391e87 0.3.17 2016-08-09 22:16:31 -07:00
81667f4df5 Bump pxt-core to 0.3.22 2016-08-09 22:16:28 -07:00
835048132c adjustments to electron app 2016-08-09 22:08:46 -07:00
00217305c2 0.3.16 2016-08-09 12:38:30 -07:00
85e8a70f76 Bump pxt-core to 0.3.21 2016-08-09 12:38:28 -07:00
bbdf27de5a adding pxt-neopixel to pre-populated package list 2016-08-09 11:02:23 -07:00
3e63d4083e update title 2016-08-09 10:27:39 -07:00
d1b8e3c752 added electron host 2016-08-09 09:55:37 -07:00
1164feb754 More snippet types 2016-08-09 16:55:43 +01:00
9ebd9d4f04 Add more snippet types for better detection 2016-08-09 16:52:24 +01:00
9fd2a3a3e6 Remove trailing whitespace 2016-08-09 16:39:50 +01:00
7f40889103 Add package info to mic docs (for testing) 2016-08-09 16:35:45 +01:00
ee37b4a959 Add package info to radio docs (for testing) 2016-08-09 16:28:08 +01:00
99d05ec91b Merge branch 'master' of https://github.com/thomasdenney/pxt-microbit 2016-08-09 16:11:27 +01:00
412e5bd034 Fix doc comment 2016-08-09 16:10:53 +01:00
141420d337 Correct Bluetooth doc comment 2016-08-09 16:05:25 +01:00
084f83ba1b Merge branch 'master' of https://github.com/thomasdenney/pxt-microbit 2016-08-09 15:13:35 +01:00
8601eff170 fixed snippets 2016-08-08 20:44:43 -07:00
5da4d74a2a adding messenger project 2016-08-08 18:12:34 -07:00
4215574a7c 0.3.15 2016-08-08 16:58:02 -07:00
da9d986a3e Bump pxt-core to 0.3.19 2016-08-08 16:58:00 -07:00
7481b9c24c call receiveNumber in onDataReceived to flush queue if needed (startup race)
fixed simulator issue when event onDataReceived gets raised
2016-08-08 16:54:43 -07:00
de5def8dde adding led.toggle as a block 2016-08-08 16:53:55 -07:00
dd011b977a wired up onPinReleased to simulator 2016-08-08 15:27:13 -07:00
20d0dd91ad added input.onPinRelease. Fix for #294 2016-08-08 15:23:18 -07:00
825c6d57e7 testing fr jsdoc transtions 2016-08-08 13:47:45 -07:00
b3edb81d3c adding URL for SEO 2016-08-08 13:08:15 -07:00
78089da134 0.3.14 2016-08-05 08:37:58 -07:00
3aef765d35 Bump pxt-core to 0.3.18 2016-08-05 08:37:56 -07:00
f4727f12c9 0.3.13 2016-08-04 10:10:03 -07:00
a36cb65aa5 Bump pxt-core to 0.3.17 2016-08-04 10:09:56 -07:00
3b16e59ee1 Merge branch 'master' of https://github.com/Microsoft/pxt-microbit 2016-08-04 10:09:42 -07:00
f2c43c74ac support for start/length in buffer methods 2016-08-04 08:42:47 -07:00
1c4c93dc60 0.3.12 2016-08-03 17:19:26 -07:00
d73847bfba Bump pxt-core to 0.3.15 2016-08-03 17:19:19 -07:00
4e46682489 keep older value longer 2016-08-02 15:35:33 -07:00
e942fb5733 Minor linting changes 2016-07-18 10:12:00 +01:00
101 changed files with 1133 additions and 700 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ clients/win10/app/bld
clients/win10/*.opendb
clients/**/bin/**
clients/**/obj/**
clients/electron/projects
*.user
*.sw?

67
clients/electron/main.js Normal file
View File

@ -0,0 +1,67 @@
const electron = require('electron')
// Module to control application life.
const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow
// pxt toolchain
const pxt = require('pxt-core')
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
function createWindow() {
console.log('starting app...')
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800, height: 600,
webPreferences: {
nodeIntegration: false,
}
})
ts.pxt.Util.debug = true;
pxt.mainCli("C:/gh/pxt-microbit/clients/electron/node_modules/pxt-microbit", ["serve", "-just"]);
// no menu
mainWindow.setMenu(null);
// and load the index.html of the app.
mainWindow.loadURL(`http://localhost:3232/#local_token=08ba9b8f-6ccb-4202-296d-28fac7a553d9`)
// Open the DevTools.
mainWindow.webContents.openDevTools()
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

View File

@ -0,0 +1,19 @@
{
"name": "codethemicrobit",
"version": "0.1.0",
"description": "A Blocks / JavaScript editor for the micro:bit",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"author": "Microsoft",
"license": "MIT",
"devDependencies": {
"electron-prebuilt": "^1.2.0"
},
"dependencies": {
"typescript": "1.8.7",
"pxt-core": "*",
"pxt-microbit": "*"
}
}

View File

@ -6,3 +6,7 @@ if (true){}
let x = 0;
Math.random(5);
```
## See Also
[logic](/blocks/logic), [loops](/blocks/loops), [math](/blocks/math), [variables](/blocks/variables)

View File

@ -48,41 +48,45 @@ The micro:bits *scheduler* provides the capability to concurrently execute di
The first job of the scheduler is to allow multiple *subprograms* to be queued up for later execution . For our purposes, a subprogram is just a statement or sequence of statements in the context of a larger program. Consider the Touch Develop program below for counting button presses.
```
export function countButtonPresses() {
input.onButtonPressed(Button.A, () => {
count = count + 1
})
basic.forever(() => {
basic.showNumber(count, 150)
})
count = 0
}
```
The program above contains three statements that execute in order from top to bottom. The first statement
```
```blocks
let count = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
count++;
})
```
informs the scheduler that on each and every event of the A button being pressed, a subprogram (called the event handler) should be queued for execution. The event handler is demarcated by the do/end keywords; it increments the global variable `count` by one. The second statement
```
basic.forever(() => {
basic.showNumber(count, 150)
})
```
queues a `forever` loop for later execution by the scheduler; the body of this loop (between the do/end keywords) displays the current value of global variable `count` on the LED screen. The third statement
The program above contains three statements that execute in order from top to bottom.
The first statement initializes the global variable `count` to zero.
```
count = 0
```blocks
let count = 0
```
initializes the global variable `count` to zero. The function ends after the execution of these three statements, but this is not the end of program execution! Thats because the function queued the `forever` loop for execution by the scheduler.
The second statement informs the scheduler that on each and every event of the A button being pressed, a subprogram (called the event handler) should be queued for execution. The event handler is demarcated by the do/end keywords; it increments the global variable `count` by one.
```blocks
let count = 0
// ...
input.onButtonPressed(Button.A, () => {
count++;
})
```
The third statement queues a `forever` loop for later execution by the scheduler; the body of this loop (between the do/end keywords) displays the current value of global variable `count` on the LED screen. The third statement
```blocks
let count = 0
// ...
basic.forever(() => {
basic.showNumber(count, 150)
})
```
The function ends after the execution of these three statements, but this is not the end of program execution! Thats because the function queued the `forever` loop for execution by the scheduler.
The second job of the scheduler is to periodically interrupt execution to read (poll) the various inputs to the micro:bit (the buttons, pins, etc.) and fire off events (such as “button A pressed”). Recall that the firing of an event causes the event handler subprogram associated with that event to be queued for later execution. The scheduler uses a timer built into the micro:bit hardware to interrupt execution every 6 milliseconds and poll the inputs, which is more than fast enough to catch the quickest press of a button.
@ -96,9 +100,18 @@ If you hadnt guessed already, a footballer represents subprogram and dribblin
We will call this “passing control of execution” rather than “passing the ball”. However, in the world of the micro:bit, the concurrently executing subprograms are not aware of each other, so they dont actually pass control directly to one another. Rather they pass control of execution back to the scheduler and the scheduler determines the subprogram to pass control to next. The programmer inserts a call to the `pause` function to indicate a point in the subprogram where control of execution passes to the scheduler. Also, when a subprogram ends execution, control passes to the scheduler.
Lets take a look at the implementation of the `forever` statement to see an example of cooperative scheduling:
Lets take a look at the implementation of the `basic.forever` function to see an example of cooperative scheduling:
![](/static/mb/device/reactive-2.png)
```typescript
function forever(body: () => void) {
control.inBackground(() => {
while(true) {
body()
basic.pause(20)
}
})
}
```
The `forever` loop actually is a function that takes a subprogram (an *Action* in Touch Develop) as a parameter. The function uses the `control -> in background` function of the micro:bit runtime to queue a `while true` loop for execution by the scheduler. The while loop has two statements. The first statement runs the subprogram represented by the `body` parameter. The second statement passes control to the scheduler (requesting to “sleep” for 20 milliseconds).
@ -128,15 +141,15 @@ Through this example, we have seen that the micro:bit scheduler enables you to c
As a result, you can easily add a new capability to the micro:bit by just adding a new subprogram. For example, if you want to add a reset feature to the counter program, all you need to do is add a new event handler for a press of button B that sets the global variable "count" to zero, as shown below:
```
```typescript
export function countButtonPressesWithReset() {
let count = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
})
basic.forever(() => {
basic.showNumber(count, 150)
})
count = 0
input.onButtonPressed(Button.B, () => {
count = 0
})

View File

@ -34,3 +34,8 @@ Visit the cards below to starting programming JavaScript and TypeScript with the
]
```
### See Also
[calling](/js/call), [sequencing](/js/sequence), [variables](/js/variables), [operators](/js/operators), [statements](/js/statements), [functions](/js/functions),
[types](/js/types), [classes](/js/classes), [FAQ](/js/faq)

View File

@ -49,7 +49,7 @@ basic.clearScreen()
It's a syntax error to have a left parenthesis without the "closing" right parenthesis:
```typescript
```
basic.clearScreen(
```

View File

@ -43,7 +43,7 @@ Of course, one of the most fundamental patterns in class-based programming is be
Let's take a look at an example:
```ts
```ts-ignore
class Animal {
name: string;
constructor(theName: string) { this.name = theName; }
@ -105,7 +105,7 @@ In TypeScript, each member is `public` by default.
You may still mark a member `public` explicitly.
We could have written the `Animal` class from the previous section in the following way:
```ts
```ts-ignore
class Animal {
public name: string;
public constructor(theName: string) { this.name = theName; }
@ -119,7 +119,7 @@ class Animal {
When a member is marked `private`, it cannot be accessed from outside of its containing class. For example:
```ts
```ts-ignore
class Animal {
private name: string;
constructor(theName: string) { this.name = theName; }
@ -138,7 +138,7 @@ The same applies to `protected` members.
Let's look at an example to better see how this plays out in practice:
```ts
```ts-ignore
class Animal {
private name: string;
constructor(theName: string) { this.name = theName; }
@ -174,7 +174,7 @@ Even though `Employee` also has a `private` member called `name`, it's not the o
The `protected` modifier acts much like the `private` modifier with the exception that members
declared `protected` can also be accessed by instances of deriving classes. For example,
```ts
```ts-ignore
class Person {
protected name: string;
constructor(name: string) { this.name = name; }
@ -204,7 +204,7 @@ we can still use it from within an instance method of `Employee` because `Employ
A constructor may also be marked `protected`.
This means that the class cannot be instantiated outside of its containing class, but can be extended. For example,
```ts
```ts-ignore
class Person {
protected name: string;
protected constructor(theName: string) { this.name = theName; }
@ -233,7 +233,7 @@ let john = new Person("John"); // Error: The 'Person' constructor is protected
You can make properties readonly by using the `readonly` keyword.
Readonly properties must be initialized at their declaration or in the constructor.
```ts
```ts-ignore
class Octopus {
readonly name: string;
readonly numberOfLegs: number = 8;
@ -252,7 +252,7 @@ This turns out to be a very common practice.
*Parameter properties* let you create and initialize a member in one place.
Here's a further revision of the previous `Octopus` class using a parameter property:
```ts
```ts-ignore
class Octopus {
readonly numberOfLegs: number = 8;
constructor(readonly name: string) {

View File

@ -45,7 +45,7 @@ TypeScript can figure the return type out by looking at the return statements, s
In TypeScript, the number of arguments given to a function has to match the number of parameters the function expects.
```ts
```ts-ignore
function buildName(firstName: string, lastName: string) {
return firstName + " " + lastName;
}
@ -60,7 +60,7 @@ When they do, their value is `undefined`.
We can get this functionality in TypeScript by adding a `?` to the end of parameters we want to be optional.
For example, let's say we want the last name parameter from above to be optional:
```ts
```ts-ignore
function buildName(firstName: string, lastName?: string) {
if (lastName)
return firstName + " " + lastName;
@ -80,7 +80,7 @@ In TypeScript, we can also set a value that a parameter will be assigned if the
These are called default-initialized parameters.
Let's take the previous example and default the last name to `"Smith"`.
```ts
```ts-ignore
function buildName(firstName: string, lastName = "Smith") {
return firstName + " " + lastName;
}
@ -115,7 +115,7 @@ Unlike plain optional parameters, default-initialized parameters don't *need* to
If a default-initialized parameter comes before a required parameter, users need to explicitly pass `undefined` to get the default initialized value.
For example, we could write our last example with only a default initializer on `firstName`:
```ts
```ts-ignore
function buildName(firstName = "Will", lastName: string) {
return firstName + " " + lastName;
}
@ -134,7 +134,7 @@ In JavaScript, you can work with the arguments directly using the `arguments` va
In TypeScript, you can gather these arguments together into a variable:
```ts
```ts-ignore
function buildName(firstName: string, ...restOfName: string[]) {
return firstName + " " + restOfName.join(" ");
}
@ -148,7 +148,7 @@ The compiler will build an array of the arguments passed in with the name given
The ellipsis is also used in the type of the function with rest parameters:
```ts
```ts-ignore
function buildName(firstName: string, ...restOfName: string[]) {
return firstName + " " + restOfName.join(" ");
}

View File

@ -44,7 +44,7 @@ Another property of block-scoped variables is that they can't be read or written
While these variables are "present" throughout their scope, all points up until their declaration are part of their *temporal dead zone*.
This is just a sophisticated way of saying you can't access them before the `let` statement, and luckily TypeScript will let you know that.
```typescript
```typescript-ignore
a++; // illegal to use 'a' before it's declared;
let a;
```

View File

@ -62,7 +62,7 @@ export function newAction() {
Now let's implement `PRESS PIN 0` in the main. Create a condition of `input->on pin pressed("P0")` that will add one to the score and calls the method `new action`.
```
```blocks
// **. . .**
input.onButtonPressed(Button.B, () => {
basic.showNumber(game.score(), 150) // ***

View File

@ -86,3 +86,7 @@ Have fun reviewing your simulation and analyze the acceleration by chart the Exc
* The first person and second person take turns tilting the micro:bit in the "x" direction while the other player charts the data on the micro:bit!
* Review and analyze the actual micro:bit device acceleration data on Excel
* Display acceleration with y or z using plot bar graph by changing acceleration from "x" to "y" or "z"
```package
microbit-radio
```

View File

@ -34,8 +34,7 @@ Let's code the third part of Happy Birthday!
To do this, you need to add blocks after the last line of the `play` blocks. We want to continue to adding musical chords with the `play` block. Then insert the appropriate chord blocks `G`, `E`, `C`, `B`, `A` to complete the third part of the song. Modify your code so that your code looks like this.
``` blocks
```blocks
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
@ -57,7 +56,6 @@ music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
basic.pause(100);
```
* click *run * to see if the code works as expected.

View File

@ -73,6 +73,7 @@ coll.push("cow")
<br/>
```blocks
let coll: string[] = []
let index = Math.random(coll.length)
let word = coll[index]
```

View File

@ -39,7 +39,7 @@ coll.push("cat")
## 4. Write the five (5) lines of code that will add the following five words to `data->coll`: puppy, clock, night, cat, cow.
```
```ts
let coll = (<string[]>[])
```

View File

@ -42,3 +42,7 @@ radio.onDataReceived(() => { })
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to run code when an input button is pressed
* learn how to pause your code for the specified number of milliseconds
```package
microbit-radio
```

View File

@ -162,3 +162,7 @@ radio.onDataReceived(() => {
Connect the first micro:bit to your computer using your USB cable and run the pogo script on it.
Connect the second micro:bit to your computer using your USB cable and run the pogo script on it.
The first person and second person take turns jumping in the “y” direction while the other player uses the micro:bit to track the results on the micro:bit!
```package
microbit-radio
```

View File

@ -33,3 +33,7 @@ radio.receiveNumber();
* learn how to return the sum of the two numbers
* learn how to get acceleration value in milli-gravitys
* learn how to read the connector value as analog as a value comprised between 0 and 1023
```package
microbit-radio
```

View File

@ -195,4 +195,6 @@ Let's select Style 10 as an example.
* The first person and second person take shaking or moving the micor:bit in any direction while the other player charts the data on the micro:bit!
* Review and analyze the actual micro:bit device acceleration data on Excel
```package
microbit-radio
```

View File

@ -2,8 +2,13 @@
The editor is open source on GitHub under the MIT license. Contributions are welcome, please check our GitHub repos.
### Repos
### Source Code
* [microsoft/pxt-microbit](https://github.com/Microsoft/pxt-microbit), PXT target for BBC micro:bit, also includes the documentation.
* [microbit/pxt](https://github.com/Microsoft/pxt), programming experience toolkit (PXT)
* [microsoft/pxt-microbit-core](https://github.com/Microsoft/pxt-microbit-core), Yotta module used to build the BBC micro:bit runtime
## C++ Runtime
The [C++ micro:bit runtime](http://lancaster-university.github.io/microbit-docs/), created at [Lancaster University](http://www.lancaster.ac.uk/), provides access to the hardware functions of the micro:bit,
as well as a set of helper functions (such as displaying a number/image/string on the LED screen).

View File

@ -47,5 +47,6 @@ Here are some cool projects that you can build with your micro:bit!
}]
```
### See Also
[Flashing Heart](/projects/flashing-heart), [Smiley Buttons](/projects/smiley-buttons), [Love Meter](/projects/love-meter), [Rock Paper Scissors](/projects/rock-paper-scissors), [Compass](/projects/compass), [Hack your headphones](/projects/hack-your-headphones), [Banana keyboard](/projects/banana-keyboard), [Telegraph](/projects/telegraph), [Radio](/projects/radio), [Watch](/projects/the-watch)

View File

@ -0,0 +1,65 @@
# messenger
![](/static/mb/projects/a9-radio.png)
Use the radio to create an app that sends "YO" messages.
## Step 1
Use [on button pressed](/reference/input/on-button-pressed) to send the number "0" over radio.
```blocks
input.onButtonPressed(Button.A, () => {
radio.sendNumber(0);
});
```
## Step 2
Use [radio on data received](/reference/radio/on-data-received) display "YO" when the number ``0`` is received
by radio.
```blocks
let message = 0;
radio.onDataReceived(() => {
message = radio.receiveNumber();
if (message == 0) {
basic.showString("YO")
}
})
```
Compile the program and **upload the same .hex file to 2 devices!**
## Step 3
Use [on button pressed](/reference/input/on-button-pressed) to send the number "1" over radio.
```blocks
input.onButtonPressed(Button.B, () => {
radio.sendNumber(1);
});
```
## Step 4
Add blocks in [radio on data received](/reference/radio/on-data-received) to display "BYE" when the number ``1`` is received
by radio.
```blocks
let message = 0;
radio.onDataReceived(() => {
message = radio.receiveNumber();
if (message == 0) {
basic.showString("YO")
}
if (message == 1) {
basic.showString("BYE")
}
})
```
```package
microbit-radio
```

View File

@ -90,3 +90,7 @@ Have fun reviewing your simulation and analyze the acceleration by chart the Exc
### ~button /projects/the-watch
NEXT: The Watch
### ~
```package
microbit-radio
```

View File

@ -1,12 +1,12 @@
# telegraph activity
Build a telgraph.
Build a telegraph.
# micro:bit telegraph
Have you ever tried to communicate through a telegraph? Let's try coding a "Telegraph" on two BBC micro:bits !
Complete the following [guided tutorial](/projects/telegraph), your hack should look like this:
Complete the following [tutorial](/projects/telegraph), your hack should look like this:
![](/static/mb/lessons/telegraph-0.png)

View File

@ -30,6 +30,11 @@ bluetooth.onBluetoothConnected(() => {});
```
```package
microbit-radio
microbit-devices
microbit-bluetooth
```
### See Also
[basic](/reference/basic), [input](/reference/input), [music](/reference/music), [led](/reference/led), [Math (blocks)](/blocks/math), [String](/reference/types/string), [game](/reference/game), [images](/reference/images), [pins](/reference/pins), [serial](/reference/serial), [control](/reference/control), [radio](/reference/radio), [devices](/reference/devices), [bluetooth](/reference/bluetooth)

View File

@ -3,3 +3,7 @@
```cards
String.fromCharCode(0);
```
### See Also
[fromCharCode](/reference//math/string-from-char-code)

View File

@ -32,3 +32,7 @@ basic.showAnimation(`
. . . . .
`);
```
### See Also
[showNumber](/reference/basic/show-number), [showLeds](/reference/basic/show-leds), [showString](/reference/basic/show-string), [clearScreen](/reference/basic/clear-screen), [forever](/reference/basic/forever), [pause](/reference/basic/pause), [plotLeds](/reference/basic/plot-leds), [showAnimation](/reference/basic/show-animation)

View File

@ -23,7 +23,7 @@ In this animation, each row is 15 spaces wide because
there are three frames in the animation, and each frame is
five spaces wide, just like the screen on the BBC micro:bit.
```
```blocks
basic.showAnimation(`
. . # . . . # # # . . # # # .
. # # . . . . . # . . . . # .
@ -47,7 +47,7 @@ In this animation, each row is 30 spaces wide because
there are six frames in the animation, and each frame is
five spaces wide, just like the screen.
```
```blocks
basic.showAnimation(`
. . . . . # . . . . . . . . . . . . . # . . . . . # . . . .
. . # . . . . . . . . . # . . . . . . . . . # . . . . . . .

View File

@ -22,3 +22,7 @@ bluetooth.onBluetoothDisconnected(() => {
```package
microbit-bluetooth
```
### See Also
[startAccelerometerService](/reference/bluetooth/start-accelerometer-service), [startButtonService](/reference/bluetooth/start-button-service), [startIOPinService](/reference/bluetooth/start-io-pin-service), [startLEDService](/reference/bluetooth/start-led-service), [startMagnetometerService](/reference/bluetooth/start-magnetometer-service), [startTemperatureService](/reference/bluetooth/start-temperature-service), [uartRead](/reference/bluetooth/uart-read), [uartWrite](/reference/bluetooth/uart-write), [onBluetoothConnected](/reference/bluetooth/on-bluetooth-connected), [onBluetoothDisconnected](/reference/bluetooth/on-bluetooth-disconnected)

View File

@ -8,3 +8,7 @@ control.inBackground(() => {
});
control.reset();
```
### See Also
[inBackground](/reference/control/in-background), [reset](/reference/control/reset)

View File

@ -17,3 +17,11 @@ devices.onSignalStrengthChanged(() => {
});
```
```package
microbit-devices
```
### See Also
[tellCameraTo](/reference/devices/tell-camera-to), [tellRemoteControlTo](/reference/devices/tell-remote-control-to), [raiseAlertTo](/reference/devices/raise-alert-to), [onNotified](/reference/devices/on-notified), [onGamepadButton](/reference/devices/on-gamepad-button), [signalStrength](/reference/devices/signal-strength), [onSignalStrengthChanged](/reference/devices/on-signal-strength-changed)

View File

@ -0,0 +1,38 @@
# On Signal Strength Changed
Register code to run when the signal strength of the paired device changes.
### ~hint
The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device,
such as a smartphone, over Bluetooth (Smart).
The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
### ~
```sig
devices.onNotified(MesDeviceInfo.IncomingCall, () => {})
```
### Parameters
* ``body``: code to run when the signal strength changes.
### Examples
Display the signal strength on screen:
```blocks
devices.onNotified(MesDeviceInfo.IncomingCall, () => {
basic.showString("RING RING")
})
```
### See Also
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength)
```package
microbit-devices
```

View File

@ -23,7 +23,7 @@ devices.onSignalStrengthChanged(() => {})
Display the signal strength on screen:
```
```blocks
devices.onSignalStrengthChanged(() => {
basic.showNumber(devices.signalStrength(), 150)
})

View File

@ -1,47 +0,0 @@
# tell microphone to
The tell microphone to function.
Access the audio recording capabilities of the device using the ``tell microphone to`` function.
The functions in the antenna namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart). The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
### Block Editor
![](/static/mb/tell-microphone-to-0.png)
### JavaScript
```
export function tellMicrophoneTo(event: string)
```
### Parameters
* event - an event identifier
### Event values
* play
* stop
* pause
* forward
* rewind
* volume up
* volume down
* previous track
* next track
### Examples
To tell the connected device to start recording audio
```
devices.tellMicrophoneTo("start capture")
```
To tell the connected device to stop recording audio
```
devices.tellMicrophoneTo("stop capture")
```

View File

@ -9,3 +9,7 @@ game.startCountdown(10000);
game.gameOver();
game.setScore(0);
```
### See Also
[addScore](/reference/game/change-score-by), [score](/reference/game/score), [startCountdown](/reference/game/start-countdown), [gameOver](/reference/game/game-over), [setScore](/reference/game/set-score)

View File

@ -6,7 +6,7 @@ Turn off all the pixels in an [Image](/reference/images/image).
### JavaScript
```
```sig
export function clear(img: micro_bit.Image)
```
@ -18,7 +18,7 @@ export function clear(img: micro_bit.Image)
The following example turns off the pixels of `img` when the A input button is pressed:
```
```blocks
let img = images.createImage(`
. . . . .
. # # # .

View File

@ -2,12 +2,12 @@
Reports the x position of a sprite on the LED screen
```
```sig
export function x(_this: micro_bitSprites.LedSprite) : number
```
Reports the y position of a sprite on the LED screen
```
```sig
export function y(_this: micro_bitSprites.LedSprite) : number
```

View File

@ -4,24 +4,24 @@ Reports the x or y position, the current direction of a sprite, or the brightne
Reports the x position of a sprite on the LED screen
```
```sig
export function x(_this: micro_bitSprites.LedSprite) : number
```
Reports the y position of a sprite on the LED screen
```
```sig
export function y(_this: micro_bitSprites.LedSprite) : number
```
Reports the brightness of a sprite on the LED screen
```
```sig
export function brightness(_this: micro_bitSprites.LedSprite) : number
```
Reports the current direction of a sprite on the LED screen
```
```sig
export function direction(_this: micro_bitSprites.LedSprite) : number
```

View File

@ -0,0 +1,30 @@
# Set Score
Sets the current score.
```sig
game.setScore(1)
```
### Parameters
* a [number](/reference/types/number) that represents the new score.
### Examples
This program is a simple game.
Press button ``A`` as much as possible to increase the score.
Press ``B`` to display the score and reset the score.
```blocks
input.onButtonPressed(Button.B, () => {
basic.showNumber(game.score())
game.setScore(0)
})
input.onButtonPressed(Button.A, () => {
game.addScore(1)
})
```
### See Also
[score](/reference/game/score), [start countdown](/reference/game/start-countdown)

View File

@ -18,3 +18,7 @@ images.createBigImage(`
. . . . .
`);
```
### See Also
[createImage](/reference/images/create-image), [createBigImage](/reference/images/create-big-image)

View File

@ -6,7 +6,7 @@ Get the state of a pixel in an [Image](/reference/images/image).
### JavaScript
```
```sig
export function pixel(_this: micro_bit.Image, x: number, y: number) : boolean
```
@ -29,7 +29,7 @@ This example gets the state of pixel `0, 0` in the `img` variable:
### ~hide
```
```blocks
let img = images.createImage(`
. . # . . . . . . .
. # . # . . . # . .
@ -41,7 +41,7 @@ let img = images.createImage(`
### ~
```
```typescript-ignore
let state = img.pixel(0, 0)
```

View File

@ -6,7 +6,7 @@ Display an [Image](/reference/images/image) on the BBC micro:bit's [LED screen](
### JavaScript
```
```sig
export function plotFrame(_this: micro_bit.Image, index: number)
```
@ -20,7 +20,7 @@ The `plot frame` function takes the index of the frame (if there are two frames,
### Example
```
```blocks
let img = images.createImage(`
# . . . # # . . . #
. # . # . . # # # .

View File

@ -6,7 +6,7 @@ Display an [Image](/reference/images/image) on the BBC micro:bit's [LED screen](
### JavaScript
```
```sig
export function plotImage(_this: micro_bit.Image, xOffset: number)
```
@ -20,7 +20,7 @@ The `show image` function has a built in delay of 400ms after display of the ima
### Example
```
```blocks
let img = images.createImage(`
# . . . # # . . . #
. # . # . . # # # .

View File

@ -6,7 +6,7 @@ Set the on/off state of pixel in an [Image](/reference/images/image).
### JavaScript
```
```sig
export function setPixel(_this: micro_bit.Image, x: number, y: number, value: boolean)
```
@ -24,7 +24,7 @@ To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
The following example creates an image and stores it in the `img` variable. The `set pixel` function sets the centre pixel off, before `img` is shown using `show image`.
```
```blocks
let img = images.createImage(`
. . # . .
. # . # .

View File

@ -6,7 +6,7 @@ Display an [Image](/reference/images/image) on the BBC micro:bit's [LED screen](
### JavaScript
```
```sig
export function showFrame(img: micro_bit.Image, frame: number)
```
@ -20,7 +20,7 @@ The `show frame` function is the same as [plot frame](/reference/images/plot-fra
### Example
```
```blocks
let img = images.createImage(`
# . . . # # . . . #
. # . # . . # # # .

View File

@ -20,7 +20,7 @@ The following example gets the width of `img` and stores it in the `w` variable:
### ~hide
```
```blocks
let img = images.createImage(`
. . # . . . . . . .
. # . # . . . # . .
@ -32,7 +32,7 @@ let img = images.createImage(`
### ~
```
```typescript-ignore
let w = img.width()
```
@ -40,7 +40,7 @@ let w = img.width()
The following example uses the `width` function with a [for](/blocks/loops/for) loop to show each image frame on the screen:
```
```typescript
let img2 = images.createImage(`
. . # . . . # # # # . # # # .
. # # . . . . . . # . . . # .

View File

@ -39,3 +39,7 @@ input.onShake(() => {
});
```
### See Also
[onButtonPressed](/reference/input/on-button-pressed), [onGesture](/reference/input/on-gesture), [onPinPressed](/reference/input/on-pin-pressed), [buttonIsPressed](/reference/input/button-is-pressed), [compassHeading](/reference/input/compass-heading), [pinIsPressed](/reference/input/pin-is-pressed), [temperature](/reference/input/temperature), [acceleration](/reference/input/acceleration), [lightLevel](/reference/input/light-level), [rotation](/reference/input/rotation), [magneticForce](/reference/input/magnetic-force), [runningTime](/reference/input/running-time), [setAccelerometerRange](/reference/input/set-accelerometer-range), [calibrate](/reference/input/calibrate), [onLogoDown](/reference/input/on-logo-down), [onLogoUp](/reference/input/on-logo-up), [onScreenDown](/reference/input/on-screen-down), [onScreenUp](/reference/input/on-screen-up), [onShake](/reference/input/on-shake)

View File

@ -0,0 +1,48 @@
# On Pin Released
Start an [event handler](/reference/event-handler) (part of the
program that will run when something happens, like when a button is
pressed). This handler works when you release pin `0`, `1`, or `2`
together with `GND`. When you are using this function in a web
browser, click and release the pins on the screen instead of the ones on the BBC
micro:bit.
If you hold the `GND` pin with one hand and touch pin `0`, `1`, or `2`
with the other, a very small (safe) amount of electricity will flow
through your body and back into the micro:bit. This is called
**completing a circuit**. It's like you're a big wire!
```sig
input.onPinReleased(TouchPin.P0, () => {
})
```
## ~hint
This function works best when the BBC micro:bit is using batteries for power,
instead of the USB cable.
## ~
## Parameters
* ``name`` means the pin that is being released, either `P0`, `P1`, or `P2`
### Example: pin pressed counter
This program counts how many times you release the `P0` pin.
Every time you release the pin, the program shows the number of times on the screen.
```blocks
let count = 0
basic.showNumber(count, 100)
input.onPinReleased(TouchPin.P0, () => {
count = count + 1
basic.showNumber(count, 100)
})
```
### See also
[BBC micro:bit pins](/device/pins), [pin is pressed](/reference/input/pin-is-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)

View File

@ -18,3 +18,7 @@ led.toggle(0, 0);
led.toggleAll();
led.setDisplayMode(DisplayMode.BackAndWhite);
```
### See Also
[plot](/reference/led/plot), [unplot](/reference/led/unplot), [point](/reference/led/point), [brightness](/reference/led/brightness), [setBrightness](/reference/led/set-brightness), [stopAnimation](/reference/led/stop-animation), [plotBarGraph](/reference/led/plot-bar-graph), [fadeIn](/reference/led/fade-in), [fadeOut](/reference/led/fade-out), [plotAll](/reference/led/plot-all), [screenshot](/reference/led/screenshot), [toggle](/reference/led/toggle), [toggleAll](/reference/led/toggle-all), [setDisplayMode](/reference/led/set-display-mode)

View File

@ -12,3 +12,7 @@ music.tempo();
music.changeTempoBy(20);
music.setTempo(120);
```
### See Also
[playTone](/reference/music/play-tone), [ringTone](/reference/music/ring-tone), [rest](/reference/music/rest), [noteFrequency](/reference/music/note-frequency), [beat](/reference/music/beat), [tempo](/reference/music/tempo), [changeTempoBy](/reference/music/change-tempo), [setTempo](/reference/music/set-tempo)

View File

@ -17,7 +17,12 @@ pins.servoWritePin(AnalogPin.P0, 180);
pins.servoSetPulse(AnalogPin.P0, 1500);
pins.i2cReadNumber(0, NumberFormat.Int8LE);
pins.i2cWriteNumber(0, 0, NumberFormat.Int8LE);
pins.spiWrite(0);
pins.setPull(DigitalPin.P0, PinPullMode.PullDown);
pins.analogPitch(0, 0);
pins.analogSetPitchPin(AnalogPin.P0);
```
### See Also
[digitalReadPin](/reference/pins/digital-read-pin), [digitalWritePin](/reference/pins/digital-write-pin), [analogReadPin](/reference/pins/analog-read-pin), [analogWritePin](/reference/pins/analog-write-pin), [analogSetPeriod](/reference/pins/analog-set-period), [map](/reference/pins/map), [onPulsed](/reference/pins/on-pulsed), [pulseDuration](/reference/pins/pulse-duration), [servoWritePin](/reference/pins/servo-write-pin), [servoSetPulse](/reference/pins/servo-set-pulse), [i2cReadNumber](/reference/pins/i2c-read-number), [i2cWriteNumber](/reference/pins/i2c-write-number), [setPull](/reference/pins/set-pull), [analogPitch](/reference/pins/analog-pitch), [analogSetPitchPin](/reference/pins/analog-set-pitch), [spiWrite](/reference/pins/spi-write)

View File

@ -13,7 +13,7 @@ pins.analogPitch(440, 300)
### Example
```
```blocks
pins.analogSetPitchPin("P0")
let frequency1 = 440
let duration = 1000

View File

@ -12,7 +12,7 @@ pins.analogSetPitchPin(AnalogPin.P0)
### Example
```
```blocks
pins.analogSetPitchPin(AnalogPin.P0)
let frequency = 440
let duration = 1000

View File

@ -29,7 +29,7 @@ pins.servoWritePin(AnalogPin.P0, 90)
```blocks
basic.forever(() => {
let millig = input.acceleration(Dimensions.X)
let millig = input.acceleration(Dimension.X)
// map accelerometer readings to angle
let angle = pins.map(millig, -1023, 1023, 0, 180)
pins.servoWritePin(AnalogPin.P0, angle)

View File

@ -0,0 +1,19 @@
# SPI Write
Write to the SPI Slave and return the response.
```sig
pins.spiWrite(0);
```
### Parameters
* ``value``: value Data to be sent to the SPI slave
### Returns
* a [number](/reference/types/number) Response from the SPI slave
### See also
[SPI](https://developer.mbed.org/handbook/SPI)

View File

@ -15,6 +15,14 @@ radio.receiveString();
radio.receivedSignalStrength();
radio.setGroup(0);
radio.setTransmitPower(7);
radio.writeValueToSerial();
radio.setTransmitSerialNumber(false);
radio.writeValueToSerial();
```
```package
microbit-radio
```
### See Also
[sendNumber](/reference/radio/send-number), [sendValue](/reference/radio/send-value), [sendString](/reference/radio/send-string), [onDataReceived](/reference/radio/on-data-received), [receiveNumber](/reference/radio/receive-number), [receivedNumberAt](/reference/radio/received-number-at), [receiveString](/reference/radio/receive-string), [receivedSignalStrength](/reference/radio/received-signal-strength), [setGroup](/reference/radio/set-group), [setTransmitPower](/reference/radio/set-transmit-power), [setTransmitSerialNumber](/reference/radio/set-transmit-serial-number), [writeValueToSerial](/reference/radio/write-value-to-serial)

View File

@ -33,3 +33,6 @@ radio.onDataReceived(() => {
[receive number](/reference/radio/receive-number),
[send number](/reference/radio/send-number), [set group](/reference/radio/set-group)
```package
microbit-radio
```

View File

@ -64,3 +64,6 @@ basic.forever(() => {
[send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -89,3 +89,7 @@ radio.onDataReceived(() => {
### See also
[send string](/reference/radio/send-string), [on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -38,3 +38,7 @@ basic.forever(() => {
### See also
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -43,3 +43,7 @@ basic.forever(() => {
### See also
[receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -40,3 +40,7 @@ A radio that can both transmit and receive is called a _transceiver_.
### See also
[receive string](/reference/radio/receive-string), [on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -44,3 +44,6 @@ radio.onDataReceived(() => {
[receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -34,3 +34,6 @@ radio.setGroup(128)
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -38,3 +38,7 @@ radio.setTransmitPower(7)
### See also
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -0,0 +1,31 @@
# Set Transmit Serial Number
Make the ``radio`` packet embed the board serial number with each packet of data.
```sig
radio.setTransmitSerialNumber(true);
```
### Parameters
* ``transmit`` is a [boolean](/reference/types/boolean) that represents whether the serial number needs to be transmitted.
### Simulator
This function only works on the micro:bit, not in browsers.
### Example
This program makes the ``radio`` send the serial number in each packet.
```blocks
radio.setTransmitSerialNumber(true);
```
### See also
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -41,10 +41,17 @@ radio.onDataReceived(() => {
});
```
Sample output to serial when ``A`` button pressed:
```{v:27,t:323,s:0}```
```Text
{v:27,t:323,s:0}
```
### See also
[send number](/reference/radio/send-number),
[send value](/reference/radio/send-value),
[on data received](/reference/radio/on-data-received)
```package
microbit-radio
```

View File

@ -5,8 +5,12 @@ Reading and writing data over a serial connection.
```cards
serial.writeLine("");
serial.writeNumber(0);
serial.writeValue(x, 0);
serial.writeValue("x", 0);
serial.writeString("");
serial.readLine();
serial.redirect(SerialPin.P0, SerialPin.P0, BaudRate.BaudRate115200);
```
### See Also
[writeLine](/reference/serial/write-line), [writeNumber](/reference/serial/write-number), [writeValue](/reference/serial/write-value), [writeString](/reference/serial/write-string), [readLine](/reference/serial/read-line), [redirect](/reference/serial/redirect-to)

View File

@ -0,0 +1,16 @@
# Boolean
true or false.
A Boolean has one of two possible values: `true`; `false`. Boolean (logical) operators (*and*, *or*, *not*) take Boolean inputs and yields a Boolean value. Comparison operators on other types ([numbers](/reference/types/number), [strings](/reference/types/string) yields a Boolean value.
The following blocks represent the true and false Boolean values, which can be plugged in anywhere a Boolean value is expected:
```blocks
true;
false;
```
### See Also
[boolean (blocks)](/blocks/logic/boolean.md)

View File

@ -1,9 +0,0 @@
# You completed the survey!
```sim
basic.forever(() => { basic.showString("THANK YOU") })
```
Thank you for participating in this survey.
Please [contact us](mailto:microbitpilots@microsoft.com) with any information you think we might find useful.

View File

@ -1,12 +0,0 @@
# Windows 10 App
## Features
The Windows 10 App provides all the existing features of [codethemicrobit](https://codethemicrobit.com) plus the following ones:
* **auto-upload**: the compiled .hex file is automatically deployed to all connected BBC micro:bits
* **serial piping**: all serial data sent by connected BBC micro:bit is automatically imported and analyzed in the editor.
## Installing the app
Coming to the store soon!

View File

@ -0,0 +1,15 @@
{
"bluetooth": "Support for additional Bluetooth services.",
"bluetooth.onBluetoothConnected": "Register code to run when the micro:bit is connected to over Bluetooth",
"bluetooth.onBluetoothConnected|param|body": "Code to run when a Bluetooth connection is established",
"bluetooth.onBluetoothDisconnected": "Register code to run when a bluetooth connection to the micro:bit is lost",
"bluetooth.onBluetoothDisconnected|param|body": "Code to run when a Bluetooth connection is lost",
"bluetooth.startAccelerometerService": "Starts the Bluetooth accelerometer service",
"bluetooth.startButtonService": "Starts the Bluetooth button service",
"bluetooth.startIOPinService": "Starts the Bluetooth IO pin service.",
"bluetooth.startLEDService": "Starts the Bluetooth LED service",
"bluetooth.startMagnetometerService": "Starts the Bluetooth magnetometer service",
"bluetooth.startTemperatureService": "Starts the Bluetooth temperature service",
"bluetooth.uartRead": "Reads from the Bluetooth UART service buffer, returning its contents when the specified delimiter character is encountered.",
"bluetooth.uartWrite": "Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device."
}

View File

@ -1,26 +1,13 @@
{
"bluetooth": "Support for additional Bluetooth services.",
"bluetooth.onBluetoothConnected": "Register code to run when the micro:bit is connected to over Bluetooth",
"bluetooth.onBluetoothConnected|block": "on bluetooth connected",
"bluetooth.onBluetoothConnected|param|body": "Code to run when a Bluetooth connection is established",
"bluetooth.onBluetoothDisconnected": "Register code to run when a bluetooth connection to the micro:bit is lost",
"bluetooth.onBluetoothDisconnected|block": "on bluetooth disconnected",
"bluetooth.onBluetoothDisconnected|param|body": "Code to run when a Bluetooth connection is lost",
"bluetooth.startAccelerometerService": "Starts the Bluetooth accelerometer service",
"bluetooth.startAccelerometerService|block": "bluetooth accelerometer service",
"bluetooth.startButtonService": "Starts the Bluetooth button service",
"bluetooth.startButtonService|block": "bluetooth button service",
"bluetooth.startIOPinService": "Starts the Bluetooth IO pin service.",
"bluetooth.startIOPinService|block": "bluetooth io pin service",
"bluetooth.startLEDService": "Starts the Bluetooth LED service",
"bluetooth.startLEDService|block": "bluetooth led service",
"bluetooth.startMagnetometerService": "Starts the Bluetooth magnetometer service",
"bluetooth.startMagnetometerService|block": "bluetooth magnetometer service",
"bluetooth.startTemperatureService": "Starts the Bluetooth temperature service",
"bluetooth.startTemperatureService|block": "bluetooth temperature service",
"bluetooth.uartRead": "Reads from the Bluetooth UART service buffer, returning its contents when the specified delimiter character is encountered.",
"bluetooth.uartRead|block": "bluetooth uart read %del=bluetooth_uart_delimiter_conv",
"bluetooth.uartWrite": "Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.",
"bluetooth.uartWrite|block": "bluetooth uart write %data",
"bluetooth|block": "bluetooth"
}

View File

@ -84,8 +84,8 @@ namespace bluetooth {
/**
* Starts the Bluetooth UART service
*/
// help=bluetooth/start-uart-service
// blockId=bluetooth_start_uart_service block="bluetooth uart service" blockGap=8
//% help=bluetooth/start-uart-service
//% blockId=bluetooth_start_uart_service block="bluetooth uart service" blockGap=8
void startUartService() {
if (uart) return;
// 61 octet buffer size is 3 x (MTU - 3) + 1

View File

@ -49,6 +49,13 @@ declare namespace bluetooth {
//% blockId=bluetooth_start_button_service block="bluetooth button service" blockGap=8 shim=bluetooth::startButtonService
function startButtonService(): void;
/**
* Starts the Bluetooth UART service
*/
//% help=bluetooth/start-uart-service
//% blockId=bluetooth_start_uart_service block="bluetooth uart service" blockGap=8 shim=bluetooth::startUartService
function startUartService(): void;
/**
* Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.
*/

View File

@ -0,0 +1,18 @@
{
"devices": "Control a phone with the BBC micro:bit via Bluetooth.",
"devices.onGamepadButton": "Register code to run when the micro:bit receives a command from the paired gamepad.",
"devices.onGamepadButton|param|body": "code to run when button is pressed",
"devices.onGamepadButton|param|name": "button name",
"devices.onNotified": "Registers code to run when the device notifies about a particular event.",
"devices.onNotified|param|body": "code handler when event is triggered",
"devices.onNotified|param|event": "event description",
"devices.onSignalStrengthChanged": "Registers code to run when the device notifies about a change of signal strength.",
"devices.onSignalStrengthChanged|param|body": "Code run when the signal strength changes.",
"devices.raiseAlertTo": "Sends an ``alert`` command to the parent device.",
"devices.raiseAlertTo|param|event": "event description",
"devices.signalStrength": "Returns the last signal strength reported by the paired device.",
"devices.tellCameraTo": "Sends a ``camera`` command to the parent device.",
"devices.tellCameraTo|param|event": "event description",
"devices.tellRemoteControlTo": "Sends a ``remote control`` command to the parent device.",
"devices.tellRemoteControlTo|param|event": "event description"
}

View File

@ -1,26 +1,10 @@
{
"devices": "Control a phone with the BBC micro:bit via Bluetooth.",
"devices.onGamepadButton": "Register code to run when the micro:bit receives a command from the paired gamepad.",
"devices.onGamepadButton|block": "on gamepad button|%NAME",
"devices.onGamepadButton|param|body": "code to run when button is pressed",
"devices.onGamepadButton|param|name": "button name",
"devices.onNotified": "Registers code to run when the device notifies about a particular event.",
"devices.onNotified|block": "on notified|%event",
"devices.onNotified|param|body": "code handler when event is triggered",
"devices.onNotified|param|event": "event description",
"devices.onSignalStrengthChanged": "Registers code to run when the device notifies about a change of signal strength.",
"devices.onSignalStrengthChanged|block": "on signal strength changed",
"devices.onSignalStrengthChanged|param|body": "Code run when the signal strength changes.",
"devices.raiseAlertTo": "Sends an ``alert`` command to the parent device.",
"devices.raiseAlertTo|block": "raise alert to|%property",
"devices.raiseAlertTo|param|event": "event description",
"devices.signalStrength": "Returns the last signal strength reported by the paired device.",
"devices.signalStrength|block": "signal strength",
"devices.tellCameraTo": "Sends a ``camera`` command to the parent device.",
"devices.tellCameraTo|block": "tell camera to|%property",
"devices.tellCameraTo|param|event": "event description",
"devices.tellRemoteControlTo": "Sends a ``remote control`` command to the parent device.",
"devices.tellRemoteControlTo|block": "tell remote control to|%property",
"devices.tellRemoteControlTo|param|event": "event description",
"devices|block": "devices"
}

View File

@ -0,0 +1,19 @@
{
"radio": "Communicate data using radio packets",
"radio.onDataReceived": "Registers code to run when a packet is received over radio.",
"radio.receiveNumber": "Reads the next packet as a number from the radio queue.",
"radio.receiveString": "Reads the next packet as a string and returns it.",
"radio.receivedNumberAt": "Reads a number at a given index, between ``0`` and ``3``, from the packet received by ``receive number``. Not supported in simulator.",
"radio.receivedNumberAt|param|index": "index of the number to read from 0 to 3. 1 eg",
"radio.receivedSignalStrength": "Gets the received signal strength indicator (RSSI) from the packet received by ``receive number``. Not supported in simulator.\nnamespace=radio",
"radio.sendNumber": "Broadcasts a number over radio to any connected micro:bit in the group.",
"radio.sendString": "Broadcasts a number over radio to any connected micro:bit in the group.",
"radio.sendValue": "Broadcasts a name / value pair along with the device serial number\nand running time to any connected micro:bit in the group.",
"radio.sendValue|param|name": "the field name (max 12 characters), eg: \"data\"",
"radio.sendValue|param|value": "the numberic value",
"radio.setGroup": "Sets the group id for radio communications. A micro:bit can only listen to one group ID at any time.\n@ param id the group id between ``0`` and ``255``, 1 eg",
"radio.setTransmitPower": "Change the output power level of the transmitter to the given value.",
"radio.setTransmitPower|param|power": "a value in the range 0..7, where 0 is the lowest power and 7 is the highest. eg: 7",
"radio.setTransmitSerialNumber": "Set the radio to transmit the serial number in each message.",
"radio.writeValueToSerial": "Reads a value sent with `stream value` and writes it\nto the serial stream as JSON"
}

View File

@ -1,32 +1,15 @@
{
"radio": "Communicate data using radio packets",
"radio.onDataReceived": "Registers code to run when a packet is received over radio.",
"radio.onDataReceived|block": "on data received",
"radio.receiveNumber": "Reads the next packet as a number from the radio queue.",
"radio.receiveNumber|block": "receive number",
"radio.receiveString": "Reads the next packet as a string and returns it.",
"radio.receiveString|block": "receive string",
"radio.receivedNumberAt": "Reads a number at a given index, between ``0`` and ``3``, from the packet received by ``receive number``. Not supported in simulator.",
"radio.receivedNumberAt|block": "receive number|at %VALUE",
"radio.receivedNumberAt|param|index": "index of the number to read from 0 to 3. 1 eg",
"radio.receivedSignalStrength": "Gets the received signal strength indicator (RSSI) from the packet received by ``receive number``. Not supported in simulator.\nnamespace=radio",
"radio.receivedSignalStrength|block": "received signal strength",
"radio.sendNumber": "Broadcasts a number over radio to any connected micro:bit in the group.",
"radio.sendNumber|block": "send number %value",
"radio.sendString": "Broadcasts a number over radio to any connected micro:bit in the group.",
"radio.sendString|block": "send string %msg",
"radio.sendValue": "Broadcasts a name / value pair along with the device serial number\nand running time to any connected BBC micro:bit in the group.",
"radio.sendValue|block": "send|value %name|= %value",
"radio.sendValue|param|name": "the field name (max 12 characters), eg: \"data\"",
"radio.sendValue|param|value": "the numberic value",
"radio.setGroup": "Sets the group id for radio communications. A micro:bit can only listen to one group ID at any time.\n@ param id the group id between ``0`` and ``255``, 1 eg",
"radio.setGroup|block": "set group %ID",
"radio.setTransmitPower": "Change the output power level of the transmitter to the given value.",
"radio.setTransmitPower|block": "set transmit power %power",
"radio.setTransmitPower|param|power": "a value in the range 0..7, where 0 is the lowest power and 7 is the highest. eg: 7",
"radio.setTransmitSerialNumber": "Set the radio to transmit the serial number in each message.",
"radio.setTransmitSerialNumber|block": "set tranmist serial number %transmit",
"radio.writeValueToSerial": "Reads a value sent with `stream value` and writes it\nto the serial stream as JSON",
"radio.writeValueToSerial|block": "write value to serial",
"radio.onDataReceived|block": "radio on data received",
"radio.receiveNumber|block": "radio receive number",
"radio.receiveString|block": "radio receive string",
"radio.receivedNumberAt|block": "radio receive number|at %VALUE",
"radio.receivedSignalStrength|block": "radio received signal strength",
"radio.sendNumber|block": "radio send number %value",
"radio.sendString|block": "radio send string %msg",
"radio.sendValue|block": "radio send|value %name|= %value",
"radio.setGroup|block": "radio set group %ID",
"radio.setTransmitPower|block": "radio set transmit power %power",
"radio.setTransmitSerialNumber|block": "radio set transmit serial number %transmit",
"radio.writeValueToSerial|block": "radio write value to serial",
"radio|block": "radio"
}

View File

@ -114,19 +114,19 @@ namespace radio {
uBit.serial.send("{");
if (length >= 4) {
memcpy(&value, bytes, 4);
uBit.serial.send("v:"); uBit.serial.send(value);
uBit.serial.send("\"v\":"); uBit.serial.send(value);
if(length >= 8) {
memcpy(&value, bytes + 4, 4);
uBit.serial.send(",t:"); uBit.serial.send(value);
uBit.serial.send(",\"t\":"); uBit.serial.send(value);
if (length >= 12) {
memcpy(&value, bytes + 8, 4);
uBit.serial.send(",s:"); uBit.serial.send(value);
uBit.serial.send(",\"s\":"); uBit.serial.send(value);
if (length >= 13) {
char name[MAX_FIELD_NAME_LENGTH+1];
uint8_t len = min(MAX_FIELD_NAME_LENGTH, bytes[12]);
memcpy(name, bytes + 13, len);
name[len] = 0;
uBit.serial.send(",n:\""); uBit.serial.send(name); uBit.serial.send("\"");
uBit.serial.send(",\"n\":\""); uBit.serial.send(name); uBit.serial.send("\"");
}
}
}
@ -134,16 +134,6 @@ namespace radio {
uBit.serial.send("}\r\n");
}
/**
* Registers code to run when a packet is received over radio.
*/
//% help=radio/on-data-received
//% weight=50
//% blockId=radio_datagram_received_event block="radio on data received" blockGap=8
void onDataReceived(Action body) {
if (radioEnable() != MICROBIT_OK) return;
registerWithDal(MICROBIT_ID_RADIO, MICROBIT_RADIO_EVT_DATAGRAM, body);
}
/**
* Reads a number at a given index, between ``0`` and ``3``, from the packet received by ``receive number``. Not supported in simulator.
@ -176,6 +166,20 @@ namespace radio {
return receivedNumberAt(0);
}
/**
* Registers code to run when a packet is received over radio.
*/
//% help=radio/on-data-received
//% weight=50
//% blockId=radio_datagram_received_event block="radio on data received" blockGap=8
void onDataReceived(Action body) {
if (radioEnable() != MICROBIT_OK) return;
registerWithDal(MICROBIT_ID_RADIO, MICROBIT_RADIO_EVT_DATAGRAM, body);
// make the the receive buffer has a free spot
receiveNumber();
}
/**
* Reads the next packet as a string and returns it.
*/
@ -231,6 +235,7 @@ namespace radio {
//% weight=8 blockGap=8
//% blockId=radio_set_transmit_serial_number block="radio set transmit serial number %transmit"
void setTransmitSerialNumber(bool transmit) {
if (radioEnable() != MICROBIT_OK) return;
transmitSerialNumber = transmit;
}
}

View File

@ -41,14 +41,6 @@ declare namespace radio {
//% blockId=radio_write_value_serial block="radio write value to serial" shim=radio::writeValueToSerial
function writeValueToSerial(): void;
/**
* Registers code to run when a packet is received over radio.
*/
//% help=radio/on-data-received
//% weight=50
//% blockId=radio_datagram_received_event block="radio on data received" blockGap=8 shim=radio::onDataReceived
function onDataReceived(body: () => void): void;
/**
* Reads a number at a given index, between ``0`` and ``3``, from the packet received by ``receive number``. Not supported in simulator.
* @param index index of the number to read from 0 to 3. 1 eg
@ -66,6 +58,14 @@ declare namespace radio {
//% blockId=radio_datagram_receive block="radio receive number" blockGap=8 shim=radio::receiveNumber
function receiveNumber(): number;
/**
* Registers code to run when a packet is received over radio.
*/
//% help=radio/on-data-received
//% weight=50
//% blockId=radio_datagram_received_event block="radio on data received" blockGap=8 shim=radio::onDataReceived
function onDataReceived(body: () => void): void;
/**
* Reads the next packet as a string and returns it.
*/

View File

@ -0,0 +1,166 @@
{
"Math.randomBoolean":"Génère une valeur « true » ou « false » au hasard, tout comme le retournement dune pièce de monnaie.",
"String.fromCharCode":"Faire une chaîne de la donnée code de caractères ASCII.",
"basic":"Permet daccéder aux fonctionnalités de base micro : bit.",
"basic.clearScreen":"Désactiver toutes les LEDs",
"basic.forever":"Répète le code pour toujours en arrière-plan. À chaque itération, permet aux autres codes dexécuter.",
"basic.pause":"Pause pendant la durée spécifiée en millisecondes",
"basic.pause|param|ms":"Combien de temps pour faire une pause pour, par exemple : 100, 200, 500, 1000, 2000",
"basic.plotLeds":"Dessine une image sur lécran LED.",
"basic.plotLeds|param|leds":"modèle de LED à allumer\/éteindre",
"basic.showAnimation":"Montre une séquence décrans LED comme une animation.",
"basic.showAnimation|param|interval":"temps en millisecondes entre chaque rafraîchissement",
"basic.showAnimation|param|leds":"modèle de LED à allumer\/éteindre",
"basic.showLeds":"Dessine une image sur lécran LED.",
"basic.showLeds|param|interval":"temps en millisecondes pour faire une pause après dessin",
"basic.showLeds|param|leds":"le modèle de LED pour activer\/désactiver",
"basic.showNumber":"Mettez en surbrillance un numéro sur lécran. Si le numéro sinscrit sur lécran (c'est-à-dire un seul chiffre), ne défilent pas.",
"basic.showNumber|param|interval":"Vitesse de défilement ; par exemple : -100, 200, 100, 150",
"basic.showString":"Afficher du texte à lécran, un caractère à la fois. Si la chaîne sinscrit sur lécran (c'est-à-dire une lettre), ne défile pas.",
"basic.showString|param|interval":"quelle vitesse de déplacement des personnages ; par exemple : -100, 200, 100, 150",
"basic.showString|param|text":"le texte à faire défiler sur lécran, par exemple : « Bonjour ! »",
"control":"Utilitaires dexécution et événements.",
"control.inBackground":"Horaires du code qui sexécutent en arrière-plan.",
"control.reset":"Réinitialise le BBC micro : bit.",
"game":"Un moteur de jeu unique-LED sprite",
"game.addScore":"Ajoute des points pour le score actuel",
"game.addScore|param|points":"nombre de points à changer, par exemple : 1",
"game.gameOver":"Affiche un jeu au dessus de lanimation.",
"game.score":"Obtient le score actuel",
"game.setScore":"Définit la valeur actuelle de la partition",
"game.setScore|param|value":"TODO",
"game.startCountdown":"Commence un compte à rebours jeu",
"game.startCountdown|param|ms":"durée du compte à rebours en millisecondes, par exemple : 10000",
"images":"Création, manipulation et affichage dimages LED.",
"images.createBigImage":"Crée une image avec 2 images.",
"images.createImage":"Crée une image qui sadapte à lécran LED.",
"input":"Événements et des données provenant de capteurs",
"input.acceleration":"Obtenir la valeur de laccélération en milli-gravitys (lorsque le jury pose plat avec lécran vers le haut, x = 0, y = 0 et z =-1024)",
"input.acceleration|param|dimension":"TODO",
"input.buttonIsPressed":"Obtenir létat du bouton (pressé ou non) pour '' A'' et '' B''.",
"input.calibrate":"Obsolète, boussole de calibrage est automatique.",
"input.compassHeading":"Obtenir le cap compas boussole actuel en degrés.",
"input.lightLevel":"Lit le niveau de lumière appliqué à lécran LED dans une gamme de '' 0'' (noir) à 255 '''' lumineux.",
"input.magneticForce":"Obtenir la valeur de la force magnétique dans '' micro-Teslas'' ('' µT''). Cette fonction nest pas pris en charge dans le simulateur.",
"input.magneticForce|param|dimension":"TODO",
"input.onButtonPressed":"Faire quelque chose quand vous appuyez sur un bouton ('' A'', '' B'' ou les deux '' A + B'')",
"input.onButtonPressed|param|body":"TODO",
"input.onButtonPressed|param|button":"TODO",
"input.onGesture":"Attache le code à exécuter lorsque lécran vers le haut.",
"input.onGesture|param|body":"TODO",
"input.onLogoDown":"Attache le code à exécuter lorsque le logo est orienté vers le bas et le jury est vertical.",
"input.onLogoDown|param|body":"TODO",
"input.onLogoUp":"Attache le code à exécuter lorsque le logo est orienté vers le haut et le jury est vertical.",
"input.onLogoUp|param|body":"TODO",
"input.onPinPressed":"Faire quelque chose lorsque vous appuyez sur une broche ('' P0'', '' P1'' ou les deux '' P2'').",
"input.onPinPressed|param|body":"TODO",
"input.onPinPressed|param|name":"TODO",
"input.onScreenDown":"Attache le code à exécuter lorsque lécran vers le bas.",
"input.onScreenDown|param|body":"TODO",
"input.onScreenUp":"Attache le code à exécuter lorsque lécran vers le haut.",
"input.onScreenUp|param|body":"TODO",
"input.onShake":"Attache le code à exécuter lorsque lappareil est secoué.",
"input.onShake|param|body":"TODO",
"input.pinIsPressed":"Obtenir létat de la broche (pressé ou non). Nécessite de tenir au sol pour fermer le circuit.",
"input.pinIsPressed|param|name":"broche utilisée pour détecter le toucher",
"input.rotation":"La hauteur de lappareil, rotation sur axe le '' x '', en degrés.",
"input.rotation|param|kind":"TODO",
"input.runningTime":"Obtient le nombre de millisecondes écoulées depuis le pouvoir sur.",
"input.setAccelerometerRange":"Définit la plage déchantillon accéléromètre de gravités.",
"input.setAccelerometerRange|param|range":"une valeur décrivent lassurer une rigidité maximale daccélération mesurée",
"input.temperature":"Obtient la température en Celsius degrés (° C).",
"led":"Contrôle de lécran LED.",
"led.brightness":"Descendre la luminosité de lécran de 0 () à 255 (pleine intensité).",
"led.fadeIn":"Fondu dans laffichage à lécran.",
"led.fadeIn|param|ms":"TODO",
"led.fadeOut":"Sévanouit la luminosité de lécran.",
"led.fadeOut|param|ms":"TODO",
"led.plot":"Allumer la LED spécifiée par x, y coordonnées (x est horizontal, y est verticale). (0,0) est en haut à gauche.",
"led.plotAll":"Tous les voyants sallume",
"led.plotBarGraph":"Affiche un graphique à barres vertical basé sur la « valeur » et la valeur « élevée ».\nSi « élevé » est 0, le tableau sajuste automatiquement.",
"led.plotBarGraph|param|high":"valeur maximale. Si 0, la valeur maximale ramenée automatiquement, par exemple : 0",
"led.plotBarGraph|param|value":"valeur actuelle pour tracer",
"led.plot|param|x":"TODO",
"led.plot|param|y":"TODO",
"led.point":"Obtenir lÉtat marche\/arrêt de la LED spécifiée par x, y coordonnées. (0,0) est en haut à gauche.",
"led.point|param|x":"TODO",
"led.point|param|y":"TODO",
"led.screenshot":"Prend une capture décran de lécran LED et renvoie une image.",
"led.setBrightness":"Régler la luminosité de lécran de 0 (off) à 255 (pleine intensité).",
"led.setBrightness|param|value":"valeur de la luminosité, par exemple : 255, 127, 0",
"led.setDisplayMode":"Définit le mode daffichage entre noir et blanc et gris pour le rendu des LEDs.",
"led.setDisplayMode|param|mode":"TODO",
"led.stopAnimation":"Annule lanimation actuelle et efface les autres en attente danimations.",
"led.toggle":"Active\/désactive un pixel particulier",
"led.toggleAll":"Inverse laffichage actuel",
"led.toggle|param|x":"TODO",
"led.toggle|param|y":"TODO",
"led.unplot":"Éteindre la LED spécifiée par x, y coordonnées (x est horizontal, y est verticale). (0,0) est en haut à gauche.",
"led.unplot|param|x":"TODO",
"led.unplot|param|y":"TODO",
"music":"Génération de sonneries musicales via broche '' P0''.",
"music.beat":"Retourne la durée dun battement en milli-secondes",
"music.changeTempoBy":"Changer le tempo de la quantité spécifiée",
"music.changeTempoBy|param|bpm":"Le changement en battements par minute au tempo, par exemple : 20",
"music.noteFrequency":"Obtient la fréquence dune note.",
"music.noteFrequency|param|name":"le nom de la note",
"music.playTone":"Joue une tonalité via broche '' P0'' pour la durée donnée.",
"music.playTone|param|frequency":"hauteur de la tonalité pour jouer en Hertz (Hz)",
"music.playTone|param|ms":"durée de la tonalité en millisecondes (ms)",
"music.rest":"Repose (joue rien) pendant une durée spécifiée via broche '' P0''.",
"music.rest|param|ms":"reposer la durée en millisecondes (ms)",
"music.ringTone":"Joue une tonalité via broche '' P0''.",
"music.ringTone|param|frequency":"hauteur de la tonalité pour jouer en Hertz (Hz)",
"music.setTempo":"Définit le tempo à la quantité spécifiée",
"music.setTempo|param|bpm":"Le nouveau tempo en battements par minute, par exemple : 120",
"music.tempo":"Retourne le tempo en battements par minute. Tempo est la vitesse (bpm = battements par minute) à qui jouent des notes. Plus la valeur du tempo, plus vite les notes jouera.",
"pins":"Contrôle des courants à Pins pour signaux analogiques\/numériques, servos, i2c...",
"pins.analogPitch":"Émet un signal de modulation (PWM) de largeur dimpulsion à laxe de tangage actuelle. Utilisez « analog set axe de tangage » pour définir laxe de tangage.",
"pins.analogPitch|param|frequency":"TODO",
"pins.analogPitch|param|ms":"TODO",
"pins.analogReadPin":"Lire la valeur de connecteur analogique, c'est-à-dire comme une valeur comprise entre 0 et 1023.",
"pins.analogReadPin|param|name":"broche décrire à",
"pins.analogSetPeriod":"Configure la modulation de largeur dimpulsion (PWM) de la sortie à la valeur donnée en analogique ** microsecondes ** ou « 1\/1000' millisecondes.\nSi cette broche nest pas configurée comme un analogue de sortie (en utilisant « écriture analogique pin »), lopération na aucun effet.",
"pins.analogSetPeriod|param|micros":"période en micro secondes. par exemple : 20000",
"pins.analogSetPeriod|param|name":"broche analogique pour définir le délai",
"pins.analogSetPitchPin":"Définit laxe utilisé lors de lutilisation de « pins-> pitch analogique ».",
"pins.analogSetPitchPin|param|name":"TODO",
"pins.analogWritePin":"Définissez la valeur de connecteur analogique. Valeur doit être comprise entre 0 et 1023.",
"pins.analogWritePin|param|name":"nom de la broche décrire à",
"pins.analogWritePin|param|value":"valeur à écrire sur la broche entre '' 0'' et '' 1023''. par exemple : 1023, 0",
"pins.digitalReadPin":"Lire la broche spécifié ou le connecteur comme 0 ou 1",
"pins.digitalReadPin|param|name":"broche pour lire à partir",
"pins.digitalWritePin":"Définir une valeur de code pin ou le connecteur à 0 ou 1.",
"pins.digitalWritePin|param|name":"broche décrire à",
"pins.digitalWritePin|param|value":"valeur à définir sur la broche, 1 par exemple, 0",
"pins.i2cReadNumber":"Lire un numéro de 7-bit I2C adresse.",
"pins.i2cWriteNumber":"Écrire un nombre à une adresse I2C de 7 bits.",
"pins.map":"Remappe un nombre dune plage à lautre. Autrement dit, une valeur '' de faible '' serait sont mappée aux '' à faible '', une valeur de '' de haut '' à '' à haute '', valeurs intermédiaires à etc in-between, de valeurs.",
"pins.map|param|fromHigh":"limite la supérieure de la gamme actuelle de la valeur, par exemple : 1023",
"pins.map|param|fromLow":"la limite inférieure de la gamme actuelle de la valeur",
"pins.map|param|toHigh":"la limite supérieure de la cible de la valeur du rang, par exemple : 4",
"pins.map|param|toLow":"la limite inférieure de la fourchette cible de la valeur",
"pins.map|param|value":"valeur à la carte dans les rangs",
"pins.onPulsed":"Configure cette broche pour une entrée numérique et génère des événements où lhorodatage est la durée pendant laquelle cette broche a été '' élevé '' ou '' faible ''.",
"pins.pulseDuration":"Obtient la durée de la dernière impulsion en microsecondes. Cette fonction doit être appelée à partir dun gestionnaire de '' onPulsed''.",
"pins.servoSetPulse":"Configure cette broche e\/s comme une sortie analogique\/pwm, configure le laps de temps pour être 20 ms et définit la largeur dimpulsion, basée sur la valeur, il est donné ** microsecondes ** ou « 1\/1000' millisecondes.",
"pins.servoSetPulse|param|micros":"durée de limpulsion en micro secondes, par exemple : 1500",
"pins.servoSetPulse|param|name":"nom de code PIN",
"pins.servoWritePin":"Écrit une valeur à lasservissement, contrôle de larbre en conséquence. Sur un servo standard, cette fonction définira langle de larbre (en degrés), déplacer larbre à cette orientation. Sur un servo de rotation continue, cette fonction définira la vitesse du servo (avec '' 0'' en pleine vitesse dans une seule direction, '' 180'' en pleine vitesse dans lautre et une valeur de près de 90 '''' aucun mouvement).",
"pins.servoWritePin|param|name":"broche décrire à",
"pins.servoWritePin|param|value":"angle ou rotation à vitesse, par exemple : 0, 90 et 180",
"pins.setPull":"Configure lattraction de cette broche.",
"pins.setPull|param|name":"broche pour définir le mode de traction sur",
"pins.setPull|param|pull":"une des configurations mbed pull : PullUp, menu déroulant, PullNone ",
"serial":"Lire et écrire des données sur une connexion série.",
"serial.readLine":"Lit une ligne de texte à partir du port série.",
"serial.redirect":"Configuration dynamique de linstance de série pour utiliser des épingles autres que USBTX et USBRX.",
"serial.redirect|param|rx":"le nouveau NIP de réception",
"serial.redirect|param|tx":"les nouvelles goupilles de transmission",
"serial.writeLine":"Imprime une ligne de texte pour le numéro de série",
"serial.writeNumber":"Imprime une valeur numérique de la série",
"serial.writeString":"Envoie un morceau de texte via la connexion série.",
"serial.writeValue":"Écrit un « nom : valeur '' paire de ligne de la série.",
"serial.writeValue|param|name":"nom de la valeur stream, par exemple : x",
"serial.writeValue|param|value":"Écrire"
}

View File

@ -1,240 +0,0 @@
{
"Math.randomBoolean":"Génère une valeur « true » ou « false » au hasard, tout comme le retournement dune pièce de monnaie.",
"Math.randomBoolean|block":"choisir au hasard vrai ou faux",
"Math|block":"Math",
"String.fromCharCode":"Faire une chaîne de la donnée code de caractères ASCII.",
"String.fromCharCode|block":"texte de char code %code",
"String|block":"Chaîne",
"basic":"Permet d'accéder aux fonctionnalités de base micro : bit.",
"basic.clearScreen":"Désactiver toutes les LEDs",
"basic.clearScreen|block":"effacer lécran",
"basic.forever":"Répète le code pour toujours en arrière-plan. À chaque itération, permet aux autres codes d'exécuter.",
"basic.forever|block":"pour toujours",
"basic.pause":"Pause pendant la durée spécifiée en millisecondes",
"basic.pause|block":"pause (ms) %pause",
"basic.pause|param|ms":"Combien de temps pour faire une pause pour, par exemple: 100, 200, 500, 1000, 2000",
"basic.plotLeds":"Dessine une image sur l'écran LED.",
"basic.plotLeds|param|leds":"modèle de LED à allumer\/éteindre",
"basic.showAnimation":"Montre une séquence d'écrans LED comme une animation.",
"basic.showAnimation|param|interval":"temps en millisecondes entre chaque rafraîchissement",
"basic.showAnimation|param|leds":"modèle de LED à allumer\/éteindre",
"basic.showLeds":"Dessine une image sur l'écran LED.",
"basic.showLeds|block":"montrer les leds",
"basic.showLeds|param|interval":"temps en millisecondes pour faire une pause après dessin",
"basic.showLeds|param|leds":"le modèle de LED pour activer\/désactiver",
"basic.showNumber":"Mettez en surbrillance un numéro sur l'écran. Si le numéro s'inscrit sur l'écran (c'est-à-dire un seul chiffre), ne défilent pas.",
"basic.showNumber|block":"montrer|numéro %number",
"basic.showNumber|param|interval":"Vitesse de défilement ; par exemple: -100, 200, 100, 150",
"basic.showString":"Afficher du texte à l'écran, un caractère à la fois. Si la chaîne s'inscrit sur l'écran (c'est-à-dire une lettre), ne défile pas.",
"basic.showString|block":"Show|String %text",
"basic.showString|param|interval":"quelle vitesse de déplacement des personnages ; par exemple: -100, 200, 100, 150",
"basic.showString|param|text":"le texte à faire défiler sur lécran, par exemple: « Bonjour! »",
"basic|block":"base",
"control":"Utilitaires d'exécution et événements.",
"control.inBackground":"Horaires du code qui s'exécutent en arrière-plan.",
"control.inBackground|block":"exécuter en arrière-plan",
"control.reset":"Réinitialise le BBC micro : bit.",
"control.reset|block":"remise à zéro",
"control|block":"contrôle",
"game":"Un moteur de jeu unique-LED sprite",
"game.addScore":"Ajoute des points pour le score actuel",
"game.addScore|block":"changer le score par|%points",
"game.addScore|param|points":"nombre de points à changer, par exemple: 1",
"game.gameOver":"Affiche un jeu au dessus de l'animation.",
"game.gameOver|block":"fin du jeu",
"game.score":"Obtient le score actuel",
"game.score|block":"score",
"game.setScore":"Définit la valeur actuelle de la partition",
"game.setScore|param|value":"TODO",
"game.startCountdown":"Commence un compte à rebours jeu",
"game.startCountdown|block":"commencer compte à rebours|(ms) %duration",
"game.startCountdown|param|ms":"durée du compte à rebours en millisecondes, par exemple: 10000",
"game|block":"jeu",
"images":"Création, manipulation et affichage d'images LED.",
"images.createBigImage":"Crée une image avec 2 images.",
"images.createBigImage|block":"créer grande image",
"images.createImage":"Crée une image qui s'adapte à l'écran LED.",
"images.createImage|block":"créer image",
"images|block":"images",
"input":"Événements et des données provenant de capteurs",
"input.acceleration":"Obtenir la valeur de l'accélération en milli-gravitys (lorsque le jury pose plat avec l'écran vers le haut, x = 0, y = 0 et z =-1024)",
"input.acceleration|block":"accélération (mg) |%NAME",
"input.acceleration|param|dimension":"TODO",
"input.buttonIsPressed":"Obtenir l'état du bouton (pressé ou non) pour '' A'' et '' B''.",
"input.buttonIsPressed|block":"button|%NAME|est pressé",
"input.calibrate":"Obsolète, boussole de calibrage est automatique.",
"input.compassHeading":"Obtenir le cap compas boussole actuel en degrés.",
"input.compassHeading|block":"Compas de rubrique (°)",
"input.lightLevel":"Lit le niveau de lumière appliqué à l'écran LED dans une gamme de '' 0'' (noir) à 255 '''' lumineux.",
"input.lightLevel|block":"niveau dintensité lumineuse",
"input.magneticForce":"Obtenir la valeur de la force magnétique dans '' micro-Teslas'' ('' µT''). Cette fonction n'est pas pris en charge dans le simulateur.",
"input.magneticForce|block":"force magnétique (µT) |%NAME",
"input.magneticForce|param|dimension":"TODO",
"input.onButtonPressed":"Faire quelque chose quand vous appuyez sur un bouton ('' A'', '' B'' ou les deux '' A + B'')",
"input.onButtonPressed|block":"sur button|%NAME|pressed",
"input.onButtonPressed|param|body":"TODO",
"input.onButtonPressed|param|button":"TODO",
"input.onGesture":"Attache le code à exécuter lorsque l'écran vers le haut.",
"input.onGesture|block":"sur |%NAME",
"input.onGesture|param|body":"TODO",
"input.onLogoDown":"Attache le code à exécuter lorsque le logo est orienté vers le bas et le jury est vertical.",
"input.onLogoDown|param|body":"TODO",
"input.onLogoUp":"Attache le code à exécuter lorsque le logo est orienté vers le haut et le jury est vertical.",
"input.onLogoUp|param|body":"TODO",
"input.onPinPressed":"Faire quelque chose lorsque vous appuyez sur une broche ('' P0'', '' P1'' ou les deux '' P2'').",
"input.onPinPressed|block":"sur pin|%NAME|pressed",
"input.onPinPressed|param|body":"TODO",
"input.onPinPressed|param|name":"TODO",
"input.onScreenDown":"Attache le code à exécuter lorsque l'écran vers le bas.",
"input.onScreenDown|param|body":"TODO",
"input.onScreenUp":"Attache le code à exécuter lorsque l'écran vers le haut.",
"input.onScreenUp|param|body":"TODO",
"input.onShake":"Attache le code à exécuter lorsque l'appareil est secoué.",
"input.onShake|param|body":"TODO",
"input.pinIsPressed":"Obtenir l'état de la broche (pressé ou non). Nécessite de tenir au sol pour fermer le circuit.",
"input.pinIsPressed|block":"pin|%NAME|is pressée",
"input.pinIsPressed|param|name":"broche utilisée pour détecter le toucher",
"input.rotation":"La hauteur de l'appareil, rotation sur axe le '' x '', en degrés.",
"input.rotation|block":"rotation (°) |%NAME",
"input.rotation|param|kind":"TODO",
"input.runningTime":"Obtient le nombre de millisecondes écoulées depuis le pouvoir sur.",
"input.runningTime|block":"temps dexécution (ms)",
"input.setAccelerometerRange":"Définit la plage d'échantillon accéléromètre de gravités.",
"input.setAccelerometerRange|block":"Définissez accelerometer|range % plage",
"input.setAccelerometerRange|param|range":"une valeur décrivent lassurer une rigidité maximale daccélération mesurée",
"input.temperature":"Obtient la température en Celsius degrés (° C).",
"input.temperature|block":"température (° C)",
"input|block":"entrée",
"led":"Contrôle de l'écran LED.",
"led.brightness":"Descendre la luminosité de l'écran de 0 () à 255 (pleine intensité).",
"led.brightness|block":"luminosité",
"led.fadeIn":"Fondu dans l'affichage à l'écran.",
"led.fadeIn|param|ms":"TODO",
"led.fadeOut":"S'évanouit la luminosité de l'écran.",
"led.fadeOut|param|ms":"TODO",
"led.plot":"Allumer la LED spécifiée par x, y coordonnées (x est horizontal, y est verticale). (0,0) est en haut à gauche.",
"led.plotAll":"Tous les voyants s'allume",
"led.plotBarGraph":"Affiche un graphique à barres vertical basé sur la « valeur » et la valeur « élevée ».\nSi « élevé » est 0, le tableau s'ajuste automatiquement.",
"led.plotBarGraph|block":"tracer le graphe de % valeur |à %high",
"led.plotBarGraph|param|high":"valeur maximale. Si 0, la valeur maximale ramenée automatiquement, par exemple: 0",
"led.plotBarGraph|param|value":"valeur actuelle pour tracer",
"led.plot|block":"allumer|x %x|y %y",
"led.plot|param|x":"TODO",
"led.plot|param|y":"TODO",
"led.point":"Obtenir l'État marche\/arrêt de la LED spécifiée par x, y coordonnées. (0,0) est en haut à gauche.",
"led.point|block":"point|x %x|y %y",
"led.point|param|x":"TODO",
"led.point|param|y":"TODO",
"led.screenshot":"Prend une capture d'écran de l'écran LED et renvoie une image.",
"led.setBrightness":"Régler la luminosité de l'écran de 0 (off) à 255 (pleine intensité).",
"led.setBrightness|block":"spécifier la luminosité %value",
"led.setBrightness|param|value":"valeur de la luminosité, par exemple: 255, 127, 0",
"led.setDisplayMode":"Définit le mode d'affichage entre noir et blanc et gris pour le rendu des LEDs.",
"led.setDisplayMode|param|mode":"TODO",
"led.stopAnimation":"Annule l'animation actuelle et efface les autres en attente d'animations.",
"led.stopAnimation|block":"arrêter lanimation",
"led.toggle":"Active\/désactive un pixel particulier",
"led.toggleAll":"Inverse l'affichage actuel",
"led.toggle|param|x":"TODO",
"led.toggle|param|y":"TODO",
"led.unplot":"Éteindre la LED spécifiée par x, y coordonnées (x est horizontal, y est verticale). (0,0) est en haut à gauche.",
"led.unplot|block":"éteindre|x %x|y %y",
"led.unplot|param|x":"TODO",
"led.unplot|param|y":"TODO",
"led|block":"écran",
"music":"Génération de sonneries musicales via broche '' P0''.",
"music.beat":"Retourne la durée d'un battement en milli-secondes",
"music.beat|block":"%fraction|beat",
"music.changeTempoBy":"Changer le tempo de la quantité spécifiée",
"music.changeTempoBy|block":"changer le tempo par (bpm) | % valeur",
"music.changeTempoBy|param|bpm":"Le changement en battements par minute au tempo, par exemple: 20",
"music.noteFrequency":"Obtient la fréquence d'une note.",
"music.noteFrequency|block":"%note",
"music.noteFrequency|param|name":"le nom de la note",
"music.playTone":"Joue une tonalité via broche '' P0'' pour la durée donnée.",
"music.playTone|block":"jouer|ton %note=device_note|pendant %duration=device_beat",
"music.playTone|param|frequency":"hauteur de la tonalité pour jouer en Hertz (Hz)",
"music.playTone|param|ms":"durée de la tonalité en millisecondes (ms)",
"music.rest":"Repose (joue rien) pendant une durée spécifiée via broche '' P0''.",
"music.rest|block":"repos (ms) |%duration = device_beat",
"music.rest|param|ms":"reposer la durée en millisecondes (ms)",
"music.ringTone":"Joue une tonalité via broche '' P0''.",
"music.ringTone|block":"buzz (Hz)|%note=device_note",
"music.ringTone|param|frequency":"hauteur de la tonalité pour jouer en Hertz (Hz)",
"music.setTempo":"Définit le tempo à la quantité spécifiée",
"music.setTempo|block":"réglage de tempo pour (bpm) | % valeur",
"music.setTempo|param|bpm":"Le nouveau tempo en battements par minute, par exemple: 120",
"music.tempo":"Retourne le tempo en battements par minute. Tempo est la vitesse (bpm = battements par minute) à qui jouent des notes. Plus la valeur du tempo, plus vite les notes jouera.",
"music.tempo|block":"tempo (bpm)",
"music|block":"musique",
"pins":"Contrôle des courants à Pins pour signaux analogiques\/numériques, servos, i2c...",
"pins.analogPitch":"Émet un signal de modulation (PWM) de largeur d'impulsion à l'axe de tangage actuelle. Utilisez « analog set axe de tangage » pour définir l'axe de tangage.",
"pins.analogPitch|param|frequency":"TODO",
"pins.analogPitch|param|ms":"TODO",
"pins.analogReadPin":"Lire la valeur de connecteur analogique, c'est-à-dire comme une valeur comprise entre 0 et 1023.",
"pins.analogReadPin|block":"read|pin analogique %name",
"pins.analogReadPin|param|name":"broche décrire à",
"pins.analogSetPeriod":"Configure la modulation de largeur d'impulsion (PWM) de la sortie à la valeur donnée en analogique ** microsecondes ** ou « 1\/1000' millisecondes.\nSi cette broche n'est pas configurée comme un analogue de sortie (en utilisant « écriture analogique pin »), l'opération n'a aucun effet.",
"pins.analogSetPeriod|block":"Analog set period|pin %pin|to micros % (µs)",
"pins.analogSetPeriod|param|micros":"période en micro secondes. par exemple: 20000",
"pins.analogSetPeriod|param|name":"broche analogique pour définir le délai",
"pins.analogSetPitchPin":"Définit l'axe utilisé lors de l'utilisation de \"pins-> pitch analogique\".",
"pins.analogSetPitchPin|param|name":"TODO",
"pins.analogWritePin":"Définissez la valeur de connecteur analogique. Valeur doit être comprise entre 0 et 1023.",
"pins.analogWritePin|block":"write|pin analogique %name|to % valeur",
"pins.analogWritePin|param|name":"nom de la broche décrire à",
"pins.analogWritePin|param|value":"valeur à écrire sur la broche entre '' 0'' et '' 1023''. par exemple: 1023, 0",
"pins.digitalReadPin":"Lire la broche spécifié ou le connecteur comme 0 ou 1",
"pins.digitalReadPin|block":"read|pin numérique %name",
"pins.digitalReadPin|param|name":"broche pour lire à partir",
"pins.digitalWritePin":"Définir une valeur de code pin ou le connecteur à 0 ou 1.",
"pins.digitalWritePin|block":"write|pin numérique %name|to % valeur",
"pins.digitalWritePin|param|name":"broche décrire à",
"pins.digitalWritePin|param|value":"valeur à définir sur la broche, 1 par exemple, 0",
"pins.i2cReadNumber":"Lire un numéro de 7-bit I2C adresse.",
"pins.i2cReadNumber|block":"I2C lire number|at adresse %address|of format %format = i2c_sizeof",
"pins.i2cWriteNumber":"Écrire un nombre à une adresse I2C de 7 bits.",
"pins.i2cWriteNumber|block":"I2C écrire number|at adresse %address|with valeur % value|of format %format = i2c_sizeof",
"pins.map":"Remappe un nombre d'une plage à l'autre. Autrement dit, une valeur '' de faible '' serait sont mappée aux '' à faible '', une valeur de '' de haut '' à '' à haute '', valeurs intermédiaires à etc in-between, de valeurs.",
"pins.map|block":"carte % value|from %fromLow|from basse %fromHigh|to haute basse %toLow|to haute %toHigh",
"pins.map|param|fromHigh":"limite la supérieure de la gamme actuelle de la valeur, par exemple: 1023",
"pins.map|param|fromLow":"la limite inférieure de la gamme actuelle de la valeur",
"pins.map|param|toHigh":"la limite supérieure de la cible de la valeur du rang, par exemple: 4",
"pins.map|param|toLow":"la limite inférieure de la fourchette cible de la valeur",
"pins.map|param|value":"valeur à la carte dans les rangs",
"pins.onPulsed":"Configure cette broche pour une entrée numérique et génère des événements où lhorodatage est la durée pendant laquelle cette broche a été '' élevé '' ou '' faible ''.",
"pins.onPulsed|block":"on|pin %pin|pulsed %pulse",
"pins.pulseDuration":"Obtient la durée de la dernière impulsion en microsecondes. Cette fonction doit être appelée à partir dun gestionnaire de '' onPulsed''.",
"pins.pulseDuration|block":"durée de limpulsion (µs)",
"pins.servoSetPulse":"Configure cette broche e\/s comme une sortie analogique\/pwm, configure le laps de temps pour être 20 ms et définit la largeur d'impulsion, basée sur la valeur, il est donné ** microsecondes ** ou « 1\/1000' millisecondes.",
"pins.servoSetPulse|block":"servo set pulse|pin % value|to (µs) % micros",
"pins.servoSetPulse|param|micros":"durée de limpulsion en micro secondes, par exemple: 1500",
"pins.servoSetPulse|param|name":"nom de code PIN",
"pins.servoWritePin":"Écrit une valeur à l'asservissement, contrôle de l'arbre en conséquence. Sur un servo standard, cette fonction définira l'angle de l'arbre (en degrés), déplacer l'arbre à cette orientation. Sur un servo de rotation continue, cette fonction définira la vitesse du servo (avec '' 0'' en pleine vitesse dans une seule direction, '' 180 cm en pleine vitesse dans l'autre et une valeur de près de 90 '''' aucun mouvement).",
"pins.servoWritePin|block":"servo write|pin %name|to % de la valeur",
"pins.servoWritePin|param|name":"broche décrire à",
"pins.servoWritePin|param|value":"angle ou rotation à vitesse, par exemple: 0, 90 et 180",
"pins.setPull":"Configure lattraction de cette broche.",
"pins.setPull|block":"Set pull|pin %pin|to %pull",
"pins.setPull|param|name":"broche pour définir le mode de traction sur",
"pins.setPull|param|pull":"une des configurations mbed pull : PullUp, menu déroulant, PullNone ",
"pins|block":"broches",
"serial":"Lire et écrire des données sur une connexion série.",
"serial.readLine":"Lit une ligne de texte à partir du port série.",
"serial.readLine|block":"série lire ligne",
"serial.redirect":"Configuration dynamique de linstance de série pour utiliser des épingles autres que USBTX et USBRX.",
"serial.redirect|block":"redirection série to| TX %tx| Taux % du taux de baud rx|at RX %",
"serial.redirect|param|rx":"le nouveau NIP de réception",
"serial.redirect|param|tx":"les nouvelles goupilles de transmission",
"serial.writeLine":"Imprime une ligne de texte pour le numéro de série",
"serial.writeLine|block":"Serial|Write ligne %text",
"serial.writeNumber":"Imprime une valeur numérique de la série",
"serial.writeNumber|block":"% valeur Serial|Write",
"serial.writeString":"Envoie un morceau de texte via la connexion série.",
"serial.writeString|block":"%text chaîne série écriture",
"serial.writeValue":"Écrit un « nom : valeur '' paire de ligne de la série.",
"serial.writeValue|block":"serial|écrire valeur %name|= %valeur",
"serial.writeValue|param|name":"nom de la valeur stream, par exemple: x",
"serial.writeValue|param|value":"Écrire",
"serial|block":"Serial"
}

View File

@ -0,0 +1,166 @@
{
"Math.randomBoolean": "Generates a `true` or `false` value randomly, just like flipping a coin.",
"String.fromCharCode": "Make a string from the given ASCII character code.",
"basic": "Provides access to basic micro:bit functionality.",
"basic.clearScreen": "Turn off all LEDs",
"basic.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.",
"basic.pause": "Pause for the specified time in milliseconds",
"basic.pause|param|ms": "how long to pause for, eg: 100, 200, 500, 1000, 2000",
"basic.plotLeds": "Draws an image on the LED screen.",
"basic.plotLeds|param|leds": "pattern of LEDs to turn on/off",
"basic.showAnimation": "Shows a sequence of LED screens as an animation.",
"basic.showAnimation|param|interval": "time in milliseconds between each redraw",
"basic.showAnimation|param|leds": "pattern of LEDs to turn on/off",
"basic.showLeds": "Draws an image on the LED screen.",
"basic.showLeds|param|interval": "time in milliseconds to pause after drawing",
"basic.showLeds|param|leds": "the pattern of LED to turn on/off",
"basic.showNumber": "Scroll a number on the screen. If the number fits on the screen (i.e. is a single digit), do not scroll.",
"basic.showNumber|param|interval": "speed of scroll; eg: 150, 100, 200, -100",
"basic.showString": "Display text on the display, one character at a time. If the string fits on the screen (i.e. is one letter), does not scroll.",
"basic.showString|param|interval": "how fast to shift characters; eg: 150, 100, 200, -100",
"basic.showString|param|text": "the text to scroll on the screen, eg: \"Hello!\"",
"control": "Runtime and event utilities.",
"control.inBackground": "Schedules code that run in the background.",
"control.reset": "Resets the BBC micro:bit.",
"game": "A single-LED sprite game engine",
"game.addScore": "Adds points to the current score",
"game.addScore|param|points": "amount of points to change, eg: 1",
"game.gameOver": "Displays a game over animation.",
"game.score": "Gets the current score",
"game.setScore": "Sets the current score value",
"game.setScore|param|value": "TODO",
"game.startCountdown": "Starts a game countdown timer",
"game.startCountdown|param|ms": "countdown duration in milliseconds, eg: 10000",
"images": "Creation, manipulation and display of LED images.",
"images.createBigImage": "Creates an image with 2 frames.",
"images.createImage": "Creates an image that fits on the LED screen.",
"input": "Events and data from sensors",
"input.acceleration": "Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)",
"input.acceleration|param|dimension": "TODO",
"input.buttonIsPressed": "Get the button state (pressed or not) for ``A`` and ``B``.",
"input.calibrate": "Obsolete, compass calibration is automatic.",
"input.compassHeading": "Get the current compass compass heading in degrees.",
"input.lightLevel": "Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.",
"input.magneticForce": "Get the magnetic force value in ``micro-Teslas`` (``µT``). This function is not supported in the simulator.",
"input.magneticForce|param|dimension": "TODO",
"input.onButtonPressed": "Do something when a button (``A``, ``B`` or both ``A+B``) is pressed",
"input.onButtonPressed|param|body": "TODO",
"input.onButtonPressed|param|button": "TODO",
"input.onGesture": "Attaches code to run when the screen is facing up.",
"input.onGesture|param|body": "TODO",
"input.onLogoDown": "Attaches code to run when the logo is oriented downwards and the board is vertical.",
"input.onLogoDown|param|body": "TODO",
"input.onLogoUp": "Attaches code to run when the logo is oriented upwards and the board is vertical.",
"input.onLogoUp|param|body": "TODO",
"input.onPinPressed": "Do something when a pin(``P0``, ``P1`` or both ``P2``) is pressed.",
"input.onPinPressed|param|body": "TODO",
"input.onPinPressed|param|name": "TODO",
"input.onScreenDown": "Attaches code to run when the screen is facing down.",
"input.onScreenDown|param|body": "TODO",
"input.onScreenUp": "Attaches code to run when the screen is facing up.",
"input.onScreenUp|param|body": "TODO",
"input.onShake": "Attaches code to run when the device is shaken.",
"input.onShake|param|body": "TODO",
"input.pinIsPressed": "Get the pin state (pressed or not). Requires to hold the ground to close the circuit.",
"input.pinIsPressed|param|name": "pin used to detect the touch",
"input.rotation": "The pitch of the device, rotation along the ``x-axis``, in degrees.",
"input.rotation|param|kind": "TODO",
"input.runningTime": "Gets the number of milliseconds elapsed since power on.",
"input.setAccelerometerRange": "Sets the accelerometer sample range in gravities.",
"input.setAccelerometerRange|param|range": "a value describe the maximum strengh of acceleration measured",
"input.temperature": "Gets the temperature in Celsius degrees (°C).",
"led": "Control of the LED screen.",
"led.brightness": "Get the screen brightness from 0 (off) to 255 (full bright).",
"led.fadeIn": "Fades in the screen display.",
"led.fadeIn|param|ms": "TODO",
"led.fadeOut": "Fades out the screen brightness.",
"led.fadeOut|param|ms": "TODO",
"led.plot": "Turn on the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.",
"led.plotAll": "Turns all LEDS on",
"led.plotBarGraph": "Displays a vertical bar graph based on the `value` and `high` value.\nIf `high` is 0, the chart gets adjusted automatically.",
"led.plotBarGraph|param|high": "maximum value. If 0, maximum value adjusted automatically, eg: 0",
"led.plotBarGraph|param|value": "current value to plot",
"led.plot|param|x": "TODO",
"led.plot|param|y": "TODO",
"led.point": "Get the on/off state of the specified LED using x, y coordinates. (0,0) is upper left.",
"led.point|param|x": "TODO",
"led.point|param|y": "TODO",
"led.screenshot": "Takes a screenshot of the LED screen and returns an image.",
"led.setBrightness": "Set the screen brightness from 0 (off) to 255 (full bright).",
"led.setBrightness|param|value": "the brightness value, eg:255, 127, 0",
"led.setDisplayMode": "Sets the display mode between black and white and greyscale for rendering LEDs.",
"led.setDisplayMode|param|mode": "TODO",
"led.stopAnimation": "Cancels the current animation and clears other pending animations.",
"led.toggle": "Toggles a particular pixel",
"led.toggleAll": "Inverts the current LED display",
"led.toggle|param|x": "TODO",
"led.toggle|param|y": "TODO",
"led.unplot": "Turn off the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.",
"led.unplot|param|x": "TODO",
"led.unplot|param|y": "TODO",
"music": "Generation of music tones through pin ``P0``.",
"music.beat": "Returns the duration of a beat in milli-seconds",
"music.changeTempoBy": "Change the tempo by the specified amount",
"music.changeTempoBy|param|bpm": "The change in beats per minute to the tempo, eg: 20",
"music.noteFrequency": "Gets the frequency of a note.",
"music.noteFrequency|param|name": "the note name",
"music.playTone": "Plays a tone through pin ``P0`` for the given duration.",
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
"music.playTone|param|ms": "tone duration in milliseconds (ms)",
"music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.",
"music.rest|param|ms": "rest duration in milliseconds (ms)",
"music.ringTone": "Plays a tone through pin ``P0``.",
"music.ringTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
"music.setTempo": "Sets the tempo to the specified amount",
"music.setTempo|param|bpm": "The new tempo in beats per minute, eg: 120",
"music.tempo": "Returns the tempo in beats per minute. Tempo is the speed (bpm = beats per minute) at which notes play. The larger the tempo value, the faster the notes will play.",
"pins": "Control currents in Pins for analog/digital signals, servos, i2c, ...",
"pins.analogPitch": "Emits a Pulse-width modulation (PWM) signal to the current pitch pin. Use `analog set pitch pin` to define the pitch pin.",
"pins.analogPitch|param|frequency": "TODO",
"pins.analogPitch|param|ms": "TODO",
"pins.analogReadPin": "Read the connector value as analog, that is, as a value comprised between 0 and 1023.",
"pins.analogReadPin|param|name": "pin to write to",
"pins.analogSetPeriod": "Configures the Pulse-width modulation (PWM) of the analog output to the given value in **microseconds** or `1/1000` milliseconds.\nIf this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.",
"pins.analogSetPeriod|param|micros": "period in micro seconds. eg:20000",
"pins.analogSetPeriod|param|name": "analog pin to set period to",
"pins.analogSetPitchPin": "Sets the pin used when using `pins->analog pitch`.",
"pins.analogSetPitchPin|param|name": "TODO",
"pins.analogWritePin": "Set the connector value as analog. Value must be comprised between 0 and 1023.",
"pins.analogWritePin|param|name": "pin name to write to",
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0",
"pins.digitalReadPin": "Read the specified pin or connector as either 0 or 1",
"pins.digitalReadPin|param|name": "pin to read from",
"pins.digitalWritePin": "Set a pin or connector value to either 0 or 1.",
"pins.digitalWritePin|param|name": "pin to write to",
"pins.digitalWritePin|param|value": "value to set on the pin, 1 eg,0",
"pins.i2cReadNumber": "Read one number from 7-bit I2C address.",
"pins.i2cWriteNumber": "Write one number to a 7-bit I2C address.",
"pins.map": "Re-maps a number from one range to another. That is, a value of ``from low`` would get mapped to ``to low``, a value of ``from high`` to ``to high``, values in-between to values in-between, etc.",
"pins.map|param|fromHigh": "the upper bound of the value's current range, eg: 1023",
"pins.map|param|fromLow": "the lower bound of the value's current range",
"pins.map|param|toHigh": "the upper bound of the value's target range, eg: 4",
"pins.map|param|toLow": "the lower bound of the value's target range",
"pins.map|param|value": "value to map in ranges",
"pins.onPulsed": "Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.",
"pins.pulseDuration": "Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.",
"pins.servoSetPulse": "Configures this IO pin as an analog/pwm output, configures the period to be 20 ms, and sets the pulse width, based on the value it is given **microseconds** or `1/1000` milliseconds.",
"pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500",
"pins.servoSetPulse|param|name": "pin name",
"pins.servoWritePin": "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).",
"pins.servoWritePin|param|name": "pin to write to",
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
"pins.setPull": "Configures the pull of this pin.",
"pins.setPull|param|name": "pin to set the pull mode on",
"pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ",
"serial": "Reading and writing data over a serial connection.",
"serial.readLine": "Reads a line of text from the serial port.",
"serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.",
"serial.redirect|param|rx": "the new reception pin",
"serial.redirect|param|tx": "the new transmission pins",
"serial.writeLine": "Prints a line of text to the serial",
"serial.writeNumber": "Prints a numeric value to the serial",
"serial.writeString": "Sends a piece of text through Serial connection.",
"serial.writeValue": "Writes a ``name: value`` pair line to the serial.",
"serial.writeValue|param|name": "name of the value stream, eg: x",
"serial.writeValue|param|value": "to write"
}

View File

@ -1,240 +1,76 @@
{
"Math.randomBoolean": "Generates a `true` or `false` value randomly, just like flipping a coin.",
"Math.randomBoolean|block": "pick random true or false",
"Math|block": "Math",
"String.fromCharCode": "Make a string from the given ASCII character code.",
"String.fromCharCode|block": "text from char code %code",
"String|block": "String",
"basic": "Provides access to basic micro:bit functionality.",
"basic.clearScreen": "Turn off all LEDs",
"basic.clearScreen|block": "clear screen",
"basic.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.",
"basic.forever|block": "forever",
"basic.pause": "Pause for the specified time in milliseconds",
"basic.pause|block": "pause (ms) %pause",
"basic.pause|param|ms": "how long to pause for, eg: 100, 200, 500, 1000, 2000",
"basic.plotLeds": "Draws an image on the LED screen.",
"basic.plotLeds|param|leds": "pattern of LEDs to turn on/off",
"basic.showAnimation": "Shows a sequence of LED screens as an animation.",
"basic.showAnimation|param|interval": "time in milliseconds between each redraw",
"basic.showAnimation|param|leds": "pattern of LEDs to turn on/off",
"basic.showLeds": "Draws an image on the LED screen.",
"basic.showLeds|block": "show leds",
"basic.showLeds|param|interval": "time in milliseconds to pause after drawing",
"basic.showLeds|param|leds": "the pattern of LED to turn on/off",
"basic.showNumber": "Scroll a number on the screen. If the number fits on the screen (i.e. is a single digit), do not scroll.",
"basic.showNumber|block": "show|number %number",
"basic.showNumber|param|interval": "speed of scroll; eg: 150, 100, 200, -100",
"basic.showString": "Display text on the display, one character at a time. If the string fits on the screen (i.e. is one letter), does not scroll.",
"basic.showString|block": "show|string %text",
"basic.showString|param|interval": "how fast to shift characters; eg: 150, 100, 200, -100",
"basic.showString|param|text": "the text to scroll on the screen, eg: \"Hello!\"",
"basic|block": "basic",
"control": "Runtime and event utilities.",
"control.inBackground": "Schedules code that run in the background.",
"control.inBackground|block": "run in background",
"control.reset": "Resets the BBC micro:bit.",
"control.reset|block": "reset",
"control|block": "control",
"game": "A single-LED sprite game engine",
"game.addScore": "Adds points to the current score",
"game.addScore|block": "change score by|%points",
"game.addScore|param|points": "amount of points to change, eg: 1",
"game.gameOver": "Displays a game over animation.",
"game.gameOver|block": "game over",
"game.score": "Gets the current score",
"game.score|block": "score",
"game.setScore": "Sets the current score value",
"game.setScore|param|value": "TODO",
"game.startCountdown": "Starts a game countdown timer",
"game.startCountdown|block": "start countdown|(ms) %duration",
"game.startCountdown|param|ms": "countdown duration in milliseconds, eg: 10000",
"game|block": "game",
"images": "Creation, manipulation and display of LED images.",
"images.createBigImage": "Creates an image with 2 frames.",
"images.createBigImage|block": "create big image",
"images.createImage": "Creates an image that fits on the LED screen.",
"images.createImage|block": "create image",
"images|block": "images",
"input": "Events and data from sensors",
"input.acceleration": "Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)",
"input.acceleration|block": "acceleration (mg)|%NAME",
"input.acceleration|param|dimension": "TODO",
"input.buttonIsPressed": "Get the button state (pressed or not) for ``A`` and ``B``.",
"input.buttonIsPressed|block": "button|%NAME|is pressed",
"input.calibrate": "Obsolete, compass calibration is automatic.",
"input.compassHeading": "Get the current compass compass heading in degrees.",
"input.compassHeading|block": "compass heading (°)",
"input.lightLevel": "Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.",
"input.lightLevel|block": "light level",
"input.magneticForce": "Get the magnetic force value in ``micro-Teslas`` (``µT``). This function is not supported in the simulator.",
"input.magneticForce|block": "magnetic force (µT)|%NAME",
"input.magneticForce|param|dimension": "TODO",
"input.onButtonPressed": "Do something when a button (``A``, ``B`` or both ``A+B``) is pressed",
"input.onButtonPressed|block": "on button|%NAME|pressed",
"input.onButtonPressed|param|body": "TODO",
"input.onButtonPressed|param|button": "TODO",
"input.onGesture": "Attaches code to run when the screen is facing up.",
"input.onGesture|block": "on |%NAME",
"input.onGesture|param|body": "TODO",
"input.onLogoDown": "Attaches code to run when the logo is oriented downwards and the board is vertical.",
"input.onLogoDown|param|body": "TODO",
"input.onLogoUp": "Attaches code to run when the logo is oriented upwards and the board is vertical.",
"input.onLogoUp|param|body": "TODO",
"input.onPinPressed": "Do something when a pin(``P0``, ``P1`` or both ``P2``) is pressed.",
"input.onPinPressed|block": "on pin|%NAME|pressed",
"input.onPinPressed|param|body": "TODO",
"input.onPinPressed|param|name": "TODO",
"input.onScreenDown": "Attaches code to run when the screen is facing down.",
"input.onScreenDown|param|body": "TODO",
"input.onScreenUp": "Attaches code to run when the screen is facing up.",
"input.onScreenUp|param|body": "TODO",
"input.onShake": "Attaches code to run when the device is shaken.",
"input.onShake|param|body": "TODO",
"input.pinIsPressed": "Get the pin state (pressed or not). Requires to hold the ground to close the circuit.",
"input.pinIsPressed|block": "pin %NAME|is pressed",
"input.pinIsPressed|param|name": "pin used to detect the touch",
"input.rotation": "The pitch of the device, rotation along the ``x-axis``, in degrees.",
"input.rotation|block": "rotation (°)|%NAME",
"input.rotation|param|kind": "TODO",
"input.runningTime": "Gets the number of milliseconds elapsed since power on.",
"input.runningTime|block": "running time (ms)",
"input.setAccelerometerRange": "Sets the accelerometer sample range in gravities.",
"input.setAccelerometerRange|block": "set accelerometer|range %range",
"input.setAccelerometerRange|param|range": "a value describe the maximum strengh of acceleration measured",
"input.temperature": "Gets the temperature in Celsius degrees (°C).",
"input.temperature|block": "temperature (°C)",
"input|block": "input",
"led": "Control of the LED screen.",
"led.brightness": "Get the screen brightness from 0 (off) to 255 (full bright).",
"led.brightness|block": "brightness",
"led.fadeIn": "Fades in the screen display.",
"led.fadeIn|param|ms": "TODO",
"led.fadeOut": "Fades out the screen brightness.",
"led.fadeOut|param|ms": "TODO",
"led.plot": "Turn on the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.",
"led.plotAll": "Turns all LEDS on",
"led.plotBarGraph": "Displays a vertical bar graph based on the `value` and `high` value.\nIf `high` is 0, the chart gets adjusted automatically.",
"led.plotBarGraph|block": "plot bar graph of %value |up to %high",
"led.plotBarGraph|param|high": "maximum value. If 0, maximum value adjusted automatically, eg: 0",
"led.plotBarGraph|param|value": "current value to plot",
"led.plot|block": "plot|x %x|y %y",
"led.plot|param|x": "TODO",
"led.plot|param|y": "TODO",
"led.point": "Get the on/off state of the specified LED using x, y coordinates. (0,0) is upper left.",
"led.point|block": "point|x %x|y %y",
"led.point|param|x": "TODO",
"led.point|param|y": "TODO",
"led.screenshot": "Takes a screenshot of the LED screen and returns an image.",
"led.setBrightness": "Set the screen brightness from 0 (off) to 255 (full bright).",
"led.setBrightness|block": "set brightness %value",
"led.setBrightness|param|value": "the brightness value, eg:255, 127, 0",
"led.setDisplayMode": "Sets the display mode between black and white and greyscale for rendering LEDs.",
"led.setDisplayMode|param|mode": "TODO",
"led.stopAnimation": "Cancels the current animation and clears other pending animations.",
"led.stopAnimation|block": "stop animation",
"led.toggle": "Toggles a particular pixel",
"led.toggleAll": "Inverts the current LED display",
"led.toggle|param|x": "TODO",
"led.toggle|param|y": "TODO",
"led.unplot": "Turn off the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.",
"led.unplot|block": "unplot|x %x|y %y",
"led.unplot|param|x": "TODO",
"led.unplot|param|y": "TODO",
"led|block": "led",
"music": "Generation of music tones through pin ``P0``.",
"music.beat": "Returns the duration of a beat in milli-seconds",
"music.beat|block": "%fraction|beat",
"music.changeTempoBy": "Change the tempo by the specified amount",
"music.changeTempoBy|block": "change tempo by (bpm)|%value",
"music.changeTempoBy|param|bpm": "The change in beats per minute to the tempo, eg: 20",
"music.noteFrequency": "Gets the frequency of a note.",
"music.noteFrequency|block": "%note",
"music.noteFrequency|param|name": "the note name",
"music.playTone": "Plays a tone through pin ``P0`` for the given duration.",
"music.playTone|block": "play|tone %note=device_note|for %duration=device_beat",
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
"music.playTone|param|ms": "tone duration in milliseconds (ms)",
"music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.",
"music.rest|block": "rest(ms)|%duration=device_beat",
"music.rest|param|ms": "rest duration in milliseconds (ms)",
"music.ringTone": "Plays a tone through pin ``P0``.",
"music.ringTone|block": "ring tone (Hz)|%note=device_note",
"music.ringTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
"music.setTempo": "Sets the tempo to the specified amount",
"music.setTempo|block": "set tempo to (bpm)|%value",
"music.setTempo|param|bpm": "The new tempo in beats per minute, eg: 120",
"music.tempo": "Returns the tempo in beats per minute. Tempo is the speed (bpm = beats per minute) at which notes play. The larger the tempo value, the faster the notes will play.",
"music.tempo|block": "tempo (bpm)",
"music|block": "music",
"pins": "Control currents in Pins for analog/digital signals, servos, i2c, ...",
"pins.analogPitch": "Emits a Pulse-width modulation (PWM) signal to the current pitch pin. Use `analog set pitch pin` to define the pitch pin.",
"pins.analogPitch|param|frequency": "TODO",
"pins.analogPitch|param|ms": "TODO",
"pins.analogReadPin": "Read the connector value as analog, that is, as a value comprised between 0 and 1023.",
"pins.analogReadPin|block": "analog read|pin %name",
"pins.analogReadPin|param|name": "pin to write to",
"pins.analogSetPeriod": "Configures the Pulse-width modulation (PWM) of the analog output to the given value in **microseconds** or `1/1000` milliseconds.\nIf this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.",
"pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros",
"pins.analogSetPeriod|param|micros": "period in micro seconds. eg:20000",
"pins.analogSetPeriod|param|name": "analog pin to set period to",
"pins.analogSetPitchPin": "Sets the pin used when using `pins->analog pitch`.",
"pins.analogSetPitchPin|param|name": "TODO",
"pins.analogWritePin": "Set the connector value as analog. Value must be comprised between 0 and 1023.",
"pins.analogWritePin|block": "analog write|pin %name|to %value",
"pins.analogWritePin|param|name": "pin name to write to",
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0",
"pins.digitalReadPin": "Read the specified pin or connector as either 0 or 1",
"pins.digitalReadPin|block": "digital read|pin %name",
"pins.digitalReadPin|param|name": "pin to read from",
"pins.digitalWritePin": "Set a pin or connector value to either 0 or 1.",
"pins.digitalWritePin|block": "digital write|pin %name|to %value",
"pins.digitalWritePin|param|name": "pin to write to",
"pins.digitalWritePin|param|value": "value to set on the pin, 1 eg,0",
"pins.i2cReadNumber": "Read one number from 7-bit I2C address.",
"pins.i2cReadNumber|block": "i2c read number|at address %address|of format %format=i2c_sizeof",
"pins.i2cWriteNumber": "Write one number to a 7-bit I2C address.",
"pins.i2cWriteNumber|block": "i2c write number|at address %address|with value %value|of format %format=i2c_sizeof",
"pins.map": "Re-maps a number from one range to another. That is, a value of ``from low`` would get mapped to ``to low``, a value of ``from high`` to ``to high``, values in-between to values in-between, etc.",
"pins.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh",
"pins.map|param|fromHigh": "the upper bound of the value's current range, eg: 1023",
"pins.map|param|fromLow": "the lower bound of the value's current range",
"pins.map|param|toHigh": "the upper bound of the value's target range, eg: 4",
"pins.map|param|toLow": "the lower bound of the value's target range",
"pins.map|param|value": "value to map in ranges",
"pins.onPulsed": "Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.",
"pins.onPulsed|block": "on|pin %pin|pulsed %pulse",
"pins.pulseDuration": "Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.",
"pins.pulseDuration|block": "pulse duration (µs)",
"pins.servoSetPulse": "Configures this IO pin as an analog/pwm output, configures the period to be 20 ms, and sets the pulse width, based on the value it is given **microseconds** or `1/1000` milliseconds.",
"pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros",
"pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500",
"pins.servoSetPulse|param|name": "pin name",
"pins.servoWritePin": "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).",
"pins.servoWritePin|block": "servo write|pin %name|to %value",
"pins.servoWritePin|param|name": "pin to write to",
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
"pins.setPull": "Configures the pull of this pin.",
"pins.setPull|block": "set pull|pin %pin|to %pull",
"pins.setPull|param|name": "pin to set the pull mode on",
"pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ",
"pins|block": "pins",
"serial": "Reading and writing data over a serial connection.",
"serial.readLine": "Reads a line of text from the serial port.",
"serial.readLine|block": "serial read line",
"serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.",
"serial.redirect|block": "serial redirect to|TX %tx|RX %rx|at baud rate %rate",
"serial.redirect|param|rx": "the new reception pin",
"serial.redirect|param|tx": "the new transmission pins",
"serial.writeLine": "Prints a line of text to the serial",
"serial.writeLine|block": "serial|write line %text",
"serial.writeNumber": "Prints a numeric value to the serial",
"serial.writeNumber|block": "serial|write number %value",
"serial.writeString": "Sends a piece of text through Serial connection.",
"serial.writeString|block": "serial write string %text",
"serial.writeValue": "Writes a ``name: value`` pair line to the serial.",
"serial.writeValue|block": "serial|write value %name|= %value",
"serial.writeValue|param|name": "name of the value stream, eg: x",
"serial.writeValue|param|value": "to write",
"serial|block": "serial"
}

View File

@ -123,21 +123,25 @@ namespace BufferMethods {
/**
* Shift buffer left in place, with zero padding.
* @param offset number of bytes to shift; use negative value to shift right
* @param start start offset in buffer. Default is 0.
* @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1
*/
//%
void shift(Buffer buf, int offset)
void shift(Buffer buf, int offset, int start = 0, int length = -1)
{
ManagedBuffer(buf).shift(offset);
ManagedBuffer(buf).shift(offset, start, length);
}
/**
* Rotate buffer left in place.
* @param offset number of bytes to shift; use negative value to shift right
* @param start start offset in buffer. Default is 0.
* @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1
*/
//%
void rotate(Buffer buf, int offset)
void rotate(Buffer buf, int offset, int start = 0, int length = -1)
{
ManagedBuffer(buf).rotate(offset);
ManagedBuffer(buf).rotate(offset, start, length);
}
// int readBytes(uint8_t *dst, int offset, int length, bool swapBytes = false) const;

View File

@ -23,18 +23,17 @@ namespace control {
* Display specified error code and stop the program.
*/
//% shim=pxtrt::panic
export function panic(code: number) {
}
export function panic(code: number) { }
/**
* If the condition is false, display msg on serial console, and panic with code 098.
*/
export function assert(condition:boolean, msg?: string)
{
export function assert(condition: boolean, msg ?: string) {
if (!condition) {
console.log("ASSERTION FAILED")
if (msg != null)
if (msg != null) {
console.log(msg)
}
panic(98)
}
}

View File

@ -288,8 +288,6 @@ declare namespace led {
//% block="none"
PullNone = 2,
}
declare namespace pins {
}
declare enum SerialPin {

View File

@ -135,12 +135,12 @@ namespace input {
}
/**
* Do something when a pin(``P0``, ``P1`` or both ``P2``) is pressed.
* @param name TODO
* @param body TODO
* Do something when a pin is pressed.
* @param name the pin that needs to be pressed
* @param body the code to run when the pin is pressed
*/
//% help=input/on-pin-pressed weight=83
//% blockId=device_pin_event block="on pin|%NAME|pressed" icon="\uf094"
//% blockId=device_pin_event block="on pin %NAME|pressed" icon="\uf094"
void onPinPressed(TouchPin name, Action body) {
auto pin = getPin((int)name);
if (!pin) return;
@ -150,6 +150,22 @@ namespace input {
registerWithDal((int)name, MICROBIT_BUTTON_EVT_CLICK, body);
}
/**
* Do something when a pin is released.
* @param name the pin that needs to be released
* @param body the code to run when the pin is released
*/
//% help=input/on-pin-released weight=6 blockGap=8
//% blockId=device_pin_released block="on pin %NAME|released" icon="\uf094"
void onPinReleased(TouchPin name, Action body) {
auto pin = getPin((int)name);
if (!pin) return;
// Forces the PIN to switch to makey-makey style detection.
pin->isTouched();
registerWithDal((int)name, MICROBIT_BUTTON_EVT_UP, body);
}
/**
* Get the button state (pressed or not) for ``A`` and ``B``.
*/
@ -237,7 +253,7 @@ namespace input {
* The pitch of the device, rotation along the ``x-axis``, in degrees.
* @param kind TODO
*/
//% help=/input/rotation weight=52
//% help=input/rotation weight=52
//% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 icon="\uf197"
int rotation(Rotation kind) {
switch (kind) {

View File

@ -77,7 +77,7 @@ namespace led {
* Sets the display mode between black and white and greyscale for rendering LEDs.
* @param mode TODO
*/
//% weight=1 help=/led/set-display-mode
//% weight=1 help=led/set-display-mode
void setDisplayMode(DisplayMode_ mode) {
uBit.display.setDisplayMode((DisplayMode)mode);
}

View File

@ -15,7 +15,7 @@
* @param value current value to plot
* @param high maximum value. If 0, maximum value adjusted automatically, eg: 0
*/
//% help=/led/plot-bar-graph weight=20
//% help=led/plot-bar-graph weight=20
//% blockId=device_plot_bar_graph block="plot bar graph of %value |up to %high" icon="\uf080" blockExternalInputs=true
export function plotBarGraph(value: number, high: number): void {
let now = input.runningTime();
@ -23,7 +23,7 @@
value = Math.abs(value);
if (high != 0) barGraphHigh = high;
else if (value > barGraphHigh || now - barGraphHighLast > 5000) {
else if (value > barGraphHigh || now - barGraphHighLast > 10000) {
barGraphHigh = value;
barGraphHighLast = now;
}
@ -51,7 +51,8 @@
* @param x TODO
* @param y TODO
*/
//% help=led/toggle
//% help=led/toggle weight=77
//% blockId=device_led_toggle block="toggle|x %x|y %y" icon="\uf204" blockGap=8
export function toggle(x: number, y: number): void {
if (led.point(x, y)) {
led.unplot(x, y);

View File

@ -71,7 +71,6 @@ MicroBitPin *getPin(int id) {
}
//% color=351 weight=30
namespace pins {
#define PINOP(op) \
MicroBitPin *pin = getPin((int)name); \
@ -182,7 +181,7 @@ namespace pins {
* @param name pin name
* @param micros pulse duration in micro seconds, eg:1500
*/
//% help=pins/serial-set-pulse weight=19
//% help=pins/servo-set-pulse weight=19
//% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros"
void servoSetPulse(AnalogPin name, int micros) {
PINOP(setServoPulseUs(micros));
@ -268,4 +267,23 @@ namespace pins {
{
uBit.i2c.write(address << 1, (char*)buf->payload, buf->length, repeat);
}
SPI* spi = NULL;
SPI* allocSPI() {
if (spi == NULL)
spi = new SPI(MOSI, MISO, SCK);
return spi;
}
/**
* Write to the SPI slave and return the response
* @param value Data to be sent to the SPI slave
*/
//% help=pins/spi-write weight=5
//% blockId=spi_write block="spi write %value"
int spiWrite(int value) {
auto p = allocSPI();
return p->write(value);
}
}

View File

@ -30,7 +30,7 @@ namespace pins {
/**
* Write one number to a 7-bit I2C address.
*/
//% help=pins/i2c-write-number
//% help=pins/i2c-write-number blockGap=8
//% 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 {
let buf = createBuffer(pins.sizeOf(format))

View File

@ -26,7 +26,8 @@
"pins.ts",
"serial.cpp",
"serial.ts",
"buffer.cpp"
"buffer.cpp",
"_locales/fr/microbit-jsdoc-strings.json"
],
"public": true,
"dependencies": {},

View File

@ -213,14 +213,23 @@ declare namespace input {
function onGesture(gesture: Gesture, body: () => void): void;
/**
* Do something when a pin(``P0``, ``P1`` or both ``P2``) is pressed.
* @param name TODO
* @param body TODO
* Do something when a pin is pressed.
* @param name the pin that needs to be pressed
* @param body the code to run when the pin is pressed
*/
//% help=input/on-pin-pressed weight=83
//% blockId=device_pin_event block="on pin|%NAME|pressed" icon="\uf094" shim=input::onPinPressed
//% blockId=device_pin_event block="on pin %NAME|pressed" icon="\uf094" shim=input::onPinPressed
function onPinPressed(name: TouchPin, body: () => void): void;
/**
* Do something when a pin is released.
* @param name the pin that needs to be released
* @param body the code to run when the pin is released
*/
//% help=input/on-pin-released weight=6 blockGap=8
//% blockId=device_pin_released block="on pin %NAME|released" icon="\uf094" shim=input::onPinReleased
function onPinReleased(name: TouchPin, body: () => void): void;
/**
* Get the button state (pressed or not) for ``A`` and ``B``.
*/
@ -274,7 +283,7 @@ declare namespace input {
* The pitch of the device, rotation along the ``x-axis``, in degrees.
* @param kind TODO
*/
//% help=/input/rotation weight=52
//% help=input/rotation weight=52
//% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 icon="\uf197" shim=input::rotation
function rotation(kind: Rotation): number;
@ -430,7 +439,7 @@ declare namespace led {
* Sets the display mode between black and white and greyscale for rendering LEDs.
* @param mode TODO
*/
//% weight=1 help=/led/set-display-mode shim=led::setDisplayMode
//% weight=1 help=led/set-display-mode shim=led::setDisplayMode
function setDisplayMode(mode: DisplayMode): void;
/**
@ -439,10 +448,6 @@ declare namespace led {
//% help=led/screenshot shim=led::screenshot
function screenshot(): Image;
}
//% color=351 weight=30
declare namespace pins {
/**
@ -518,7 +523,7 @@ declare namespace pins {
* @param name pin name
* @param micros pulse duration in micro seconds, eg:1500
*/
//% help=pins/serial-set-pulse weight=19
//% help=pins/servo-set-pulse weight=19
//% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" shim=pins::servoSetPulse
function servoSetPulse(name: AnalogPin, micros: number): void;
@ -564,6 +569,14 @@ declare namespace pins {
*/
//% repeat.defl=0 shim=pins::i2cWriteBuffer
function i2cWriteBuffer(address: number, buf: Buffer, repeat?: boolean): void;
/**
* Write to the SPI slave and return the response
* @param value Data to be sent to the SPI slave
*/
//% help=pins/spi-write weight=5
//% blockId=spi_write block="spi write %value" shim=pins::spiWrite
function spiWrite(value: number): number;
}
@ -635,16 +648,20 @@ declare interface Buffer {
/**
* Shift buffer left in place, with zero padding.
* @param offset number of bytes to shift; use negative value to shift right
* @param start start offset in buffer. Default is 0.
* @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1
*/
//% shim=BufferMethods::shift
shift(offset: number): void;
//% start.defl=0 length.defl=-1 shim=BufferMethods::shift
shift(offset: number, start?: number, length?: number): void;
/**
* Rotate buffer left in place.
* @param offset number of bytes to shift; use negative value to shift right
* @param start start offset in buffer. Default is 0.
* @param length number of elements in buffer. If negative, length is set as the buffer length minus start. eg: -1
*/
//% shim=BufferMethods::rotate
rotate(offset: number): void;
//% start.defl=0 length.defl=-1 shim=BufferMethods::rotate
rotate(offset: number, start?: number, length?: number): void;
/**
* Write contents of `src` at `dstOffset` in current buffer.

View File

@ -1,6 +1,6 @@
{
"name": "pxt-microbit",
"version": "0.3.11",
"version": "0.3.23",
"description": "BBC micro:bit target for PXT",
"keywords": [
"JavaScript",
@ -29,6 +29,6 @@
"typescript": "^1.8.7"
},
"dependencies": {
"pxt-core": "0.3.14"
"pxt-core": "0.3.26"
}
}

View File

@ -1,7 +1,7 @@
{
"id": "microbit",
"name": "code the micro:bit",
"title": "code the micro:bit",
"title": "code the micro:bit - Blocks / Javascript editor",
"corepkg": "microbit",
"bundleddirs": [
"libs/microbit",
@ -11,7 +11,10 @@
],
"cloud": {
"workspace": false,
"packages": true
"packages": true,
"preferredPackages": [
"Microsoft/pxt-neopixel"
]
},
"blocksprj": {
"id": "blocksprj",
@ -70,7 +73,7 @@
"yottaTarget": "bbc-microbit-classic-gcc",
"yottaCorePackage": "pxt-microbit-core",
"githubCorePackage": "microsoft/pxt-microbit-core",
"gittag": "v0.1.11",
"gittag": "v0.2.2",
"serviceId": "ws"
},
"serial": {
@ -115,11 +118,7 @@
"path": "/javascript"
},
{
"name": "Streaming Data",
"path": "/streaming"
},
{
"name": "The Device",
"name": "Hardware",
"path": "/device"
}
],

View File

@ -294,7 +294,14 @@ namespace pxsim.input {
let pin = getPin(pinId);
if (!pin) return;
pin.isTouched();
input.onButtonPressed(pin.id, handler);
pxt.registerWithDal(pin.id, DAL.MICROBIT_BUTTON_EVT_CLICK, handler);
}
export function onPinReleased(pinId: number, handler: RefAction) {
let pin = getPin(pinId);
if (!pin) return;
pin.isTouched();
pxt.registerWithDal(pin.id, DAL.MICROBIT_BUTTON_EVT_UP, handler);
}
export function pinIsPressed(pinId: number): boolean {
@ -510,6 +517,7 @@ namespace pxsim.radio {
export function onDataReceived(handler: RefAction): void {
pxt.registerWithDal(DAL.MICROBIT_ID_RADIO, DAL.MICROBIT_RADIO_EVT_DATAGRAM, handler);
radio.receiveNumber();
}
}
@ -580,6 +588,11 @@ namespace pxsim.pins {
// TODO
}
export function spiWrite(value: number): number {
// TODO
return 0;
}
export function i2cReadBuffer(address: number, size: number, repeat?: boolean): RefBuffer {
// fake reading zeros
return createBuffer(size)

View File

@ -716,6 +716,7 @@ svg.sim.grayscale {
let state = this.board;
state.pins[index].touched = false;
this.updatePin(state.pins[index], index);
this.board.bus.queue(state.pins[index].id, DAL.MICROBIT_BUTTON_EVT_UP);
this.board.bus.queue(state.pins[index].id, DAL.MICROBIT_BUTTON_EVT_CLICK);
})
})
@ -734,7 +735,7 @@ svg.sim.grayscale {
let state = this.board;
state.buttons[index].pressed = false;
svg.fill(this.buttons[index], this.props.theme.buttonUp);
this.board.bus.queue(state.buttons[index].id, DAL.MICROBIT_BUTTON_EVT_UP);
this.board.bus.queue(state.buttons[index].id, DAL.MICROBIT_BUTTON_EVT_CLICK);
})
})
@ -765,6 +766,7 @@ svg.sim.grayscale {
svg.fill(this.buttons[1], this.props.theme.buttonUp);
svg.fill(this.buttons[2], this.props.theme.virtualButtonUp);
this.board.bus.queue(state.buttons[2].id, DAL.MICROBIT_BUTTON_EVT_UP);
this.board.bus.queue(state.buttons[2].id, DAL.MICROBIT_BUTTON_EVT_CLICK);
})
}

View File

@ -72,10 +72,9 @@ namespace pxsim {
}
queue(packet: PacketBuffer) {
if (this.datagram.length < 5) {
if (this.datagram.length < 4)
this.datagram.push(packet);
(<Board>runtime.board).bus.queue(DAL.MICROBIT_ID_RADIO, DAL.MICROBIT_RADIO_EVT_DATAGRAM);
}
(<Board>runtime.board).bus.queue(DAL.MICROBIT_ID_RADIO, DAL.MICROBIT_RADIO_EVT_DATAGRAM);
}
send(buffer: number[] | string) {