Compare commits
250 Commits
Author | SHA1 | Date | |
---|---|---|---|
3f66a1c16d | |||
d78781ad5a | |||
46281c3cd0 | |||
a58f67064f | |||
efe784441f | |||
05174f094a | |||
42773a1a0a | |||
32f96d09d4 | |||
05d88cb4ba | |||
7fe8dad1f6 | |||
858766ea3e | |||
81fe9afbb7 | |||
65c615f256 | |||
9c5c699fe7 | |||
dcede1703a | |||
5d33ab019d | |||
f7ec452ea0 | |||
20260e8933 | |||
d7704934e8 | |||
f1eafb0a6e | |||
27d6a8281a | |||
c5128aa497 | |||
a59394646c | |||
6851169dbe | |||
36b3486194 | |||
5d8ccd1d6d | |||
c713fe9bf4 | |||
f682e5e694 | |||
d2d776fd01 | |||
641a5e9673 | |||
93d90a2bde | |||
a54504f31c | |||
03111368e0 | |||
a973b2aec6 | |||
a7adf0e6c6 | |||
c10761128e | |||
9965f169b2 | |||
8bf755c15c | |||
d0b2a7db62 | |||
780192da3b | |||
07c1f08d18 | |||
25ac847266 | |||
63c8342b86 | |||
ea2bd7ba10 | |||
cec2d1e8af | |||
1b289b688b | |||
0cf91580cb | |||
392ebc8d07 | |||
9068aab12b | |||
85327a4e69 | |||
021260b3a4 | |||
4def93d7c5 | |||
9aca0c19fc | |||
3fcbdbdd82 | |||
4b7b6eebca | |||
2da0cf1178 | |||
141cb24e3d | |||
35483487af | |||
ec3a805326 | |||
780d8bcf8d | |||
f9a12cac64 | |||
03c2df3277 | |||
a7e98ccb3d | |||
1014d2f361 | |||
89f20a64d5 | |||
fae36a74af | |||
7e57c59b6f | |||
3141e12f4c | |||
4ebe9f595a | |||
50f0e85884 | |||
e28b5d48d4 | |||
562e96e09e | |||
6c5088f811 | |||
d5ccb7ad02 | |||
ade5176d21 | |||
d2f6d51c19 | |||
92b60a251d | |||
de9f2d7e67 | |||
4de5e3bd11 | |||
86a33e8f65 | |||
89010b6a8a | |||
48d4668a7a | |||
a2755dc4d2 | |||
52e67c6bfc | |||
5a6f23a7d0 | |||
d1b36f2022 | |||
284579181b | |||
20fcb05538 | |||
e1a2074ef5 | |||
fa3e33dab9 | |||
300a98b858 | |||
5986671bcb | |||
efd5c46143 | |||
62c1a1da35 | |||
ebbc7c983d | |||
173fc4bf7b | |||
47f1eadd27 | |||
8c06277a92 | |||
395f482f11 | |||
bbd21a84d6 | |||
fcf680e9bd | |||
8ac848c812 | |||
dd591af224 | |||
e5a7a81198 | |||
7a5228a5d0 | |||
fe5c8e520a | |||
96d354a8a8 | |||
02480b1c54 | |||
4fd321cccf | |||
4641c9456f | |||
498b5ec095 | |||
912be2ddfd | |||
6d7f8c5841 | |||
a782f4731a | |||
6e067bffd5 | |||
4a4007ba41 | |||
c9db08a2c6 | |||
5ec303b95c | |||
3d0523a298 | |||
3469ad6f8d | |||
d791738d84 | |||
355c341d36 | |||
1adb4a2bac | |||
03c0339e9a | |||
1649811015 | |||
14f16f9b2c | |||
66d3c6c7e8 | |||
7f27432222 | |||
870b26a85a | |||
aa6cb58dca | |||
6398a42dad | |||
cfc3eae77c | |||
438b745d32 | |||
21473f5b9b | |||
c85b6f9507 | |||
019b00209e | |||
6c11dbcdf4 | |||
91197c5cec | |||
9e5d9787c7 | |||
1c11a4823b | |||
d457c3e8d0 | |||
2ae21efb7b | |||
30211aa006 | |||
485a42758c | |||
0da5a5a349 | |||
efca68672a | |||
41ce2f66fa | |||
9393fc166e | |||
cfb4382941 | |||
aaca24ff5b | |||
0ce9be1a2b | |||
a88eb7fe02 | |||
06e4f7fb5c | |||
1b36485208 | |||
3b54cefa95 | |||
52857c9541 | |||
d10c2a20bd | |||
e2482cdf91 | |||
c045d87e4c | |||
34e23934b0 | |||
354196e01e | |||
bb2e8d0aef | |||
90f4e895d4 | |||
58c554caa6 | |||
6c688a7e59 | |||
71244065bb | |||
bbb1bc3dd7 | |||
806d0e2cff | |||
e0c4af1cae | |||
475821564e | |||
9d65dd605b | |||
67eec44411 | |||
280b555f86 | |||
2fcd32de0d | |||
78694e86a2 | |||
aeaa3d7bc1 | |||
af8ce3fccf | |||
47ef096b0f | |||
86c5c27b12 | |||
520c9217a5 | |||
4a34f2b932 | |||
034897b0a6 | |||
b504abc6da | |||
6dbfb9e96e | |||
d1021a30ca | |||
8d37be7cbe | |||
97066e1ba4 | |||
097564748c | |||
d873cbb6c3 | |||
adef3a6487 | |||
be0984cc4a | |||
f0947cddaa | |||
c5c5362b5d | |||
bcbbb1366a | |||
19fb5ecf01 | |||
0401aa60d2 | |||
e0c016fbf4 | |||
f046f0e50c | |||
90f48ac77a | |||
23f83df6df | |||
98e4f80399 | |||
b1fcc51bc8 | |||
63e24ce90a | |||
63d0b86508 | |||
672f3b94ca | |||
f0b91b07c1 | |||
2923d045b1 | |||
3cf36b4549 | |||
a42aa553e6 | |||
b12598e421 | |||
9a85075456 | |||
ce7b630870 | |||
9ac308da92 | |||
6315ca90e5 | |||
ecfe0a7f16 | |||
f701bca23f | |||
7313c76e8b | |||
77003b30f2 | |||
274bb9e042 | |||
e316f068e2 | |||
c75e77593a | |||
ecbf8409ea | |||
411fe52813 | |||
0d04376413 | |||
5deffe832c | |||
528f696b8c | |||
dfb5f7dd11 | |||
a4fb934a18 | |||
59b11ec2a9 | |||
d961e14e5c | |||
83c8c07b94 | |||
152f84cd79 | |||
ef58b54fdb | |||
50e2f3fa94 | |||
14f4e6092a | |||
f7a005c656 | |||
7e19fbb3ca | |||
e706809037 | |||
5d6bc2f5df | |||
22433317b9 | |||
fabf09477c | |||
f9e0fe1b8d | |||
c49fb27d4c | |||
24b20543c5 | |||
be97665ea2 | |||
657cdeb53e | |||
08575d352b | |||
c9ba7af3f3 | |||
917072a336 | |||
fd5357b273 |
2
.gitignore
vendored
@ -15,7 +15,7 @@ clients/win10/app/bld
|
||||
clients/win10/*.opendb
|
||||
clients/**/bin/**
|
||||
clients/**/obj/**
|
||||
clients/electron/projects
|
||||
electron-out
|
||||
hexcache
|
||||
|
||||
*.user
|
||||
|
26
CONTRIBUTING.md
Normal file
@ -0,0 +1,26 @@
|
||||
# Contributing Code
|
||||
|
||||
PXT accepts bug fix pull requests. For a bug fix PR to be accepted, it must first have a tracking issue that has been marked approved. Your PR should link to the bug you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
|
||||
|
||||
PXT also accepts new feature pull requests. For a feature-level PR to be accepted, it first needs to have design discussion. Design discussion can take one of two forms a) a feature request in the issue tracker that has been marked as approved or b) the PR must be accompanied by a full design spec and this spec is later approved in the open design discussion. Features are evaluated against their complexity, impact on other features, roadmap alignment, and maintainability.
|
||||
|
||||
These two blogs posts on contributing code to open source projects are a good reference: [Open Source Contribution Etiquette](http://tirania.org/blog/archive/2010/Dec-31.html) by Miguel de Icaza and [Don't "Push" Your Pull Requests](https://www.igvita.com/2011/12/19/dont-push-your-pull-requests/) by Ilya Grigorik.
|
||||
|
||||
## Security
|
||||
|
||||
If you believe you have found a security issue in PXT, please share it with us privately following the guidance at the Microsoft [Security TechCenter](https://technet.microsoft.com/en-us/security/ff852094). Reporting it via this channel helps minimize risk to projects built with PXT.
|
||||
|
||||
## Legal
|
||||
|
||||
You will need to complete a Contributor License Agreement (CLA) before your pull request can be accepted. This agreement testifies that you are granting us permission to use the source code you are submitting, and that this work is being submitted under appropriate license that we can use it.
|
||||
|
||||
You can complete the CLA by going through the steps at https://cla.microsoft.com. Once we have received the signed CLA, we'll review the request. You will only need to do this once.
|
||||
|
||||
## Housekeeping
|
||||
|
||||
Your pull request should:
|
||||
* Include a description of what your change intends to do
|
||||
* Be a child commit of a reasonably recent commit in the master branch
|
||||
* Pass all unit tests
|
||||
* Have a clear commit message
|
||||
* Include adequate tests
|
25
LICENSE.txt
Normal file
@ -0,0 +1,25 @@
|
||||
PXT - Programming Experience Toolkit
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -7,6 +7,10 @@ PXT ([Microsoft Programming Experience Toolkit](https://github.com/Microsoft/pxt
|
||||
|
||||
[](https://travis-ci.org/Microsoft/pxt-microbit)
|
||||
|
||||
## Issue tracking
|
||||
|
||||
All issue tracking for this repo happens at https://github.com/Microsoft/pxt, see you there!
|
||||
|
||||
## Local server
|
||||
|
||||
The local server allows to run the editor and the documentation from your computer.
|
||||
|
2
clients/electron/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
node_modules
|
||||
projects
|
@ -1,5 +0,0 @@
|
||||
# PXT micro:bit Electron app
|
||||
|
||||
A very basic wrapper around the web app. To install, copy the contents of this
|
||||
directory to somewhere outside the main `pxt-microbit` repository. Then run `npm
|
||||
install && npm start`.
|
@ -1,15 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>code the micro:bit</title>
|
||||
</head>
|
||||
<body>
|
||||
<webview id="webview" style="position:absolute; left:0; top:0; right:0; bottom:0"/>
|
||||
<script>
|
||||
const webview = document.getElementById("webview")
|
||||
const url = `http://localhost:3232/${window.location.hash}`
|
||||
webview.src = url
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,39 +0,0 @@
|
||||
const {app, BrowserWindow, Menu} = require('electron')
|
||||
const pxt = require('pxt-core')
|
||||
const path = require('path')
|
||||
|
||||
let win
|
||||
|
||||
const cliPath = path.join(process.cwd(), "node_modules/pxt-microbit")
|
||||
|
||||
function startServerAndCreateWindow() {
|
||||
pxt.mainCli(cliPath, ["serve", "-no-browser"])
|
||||
createWindow()
|
||||
}
|
||||
|
||||
function createWindow () {
|
||||
win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
title: "code the micro:bit"
|
||||
})
|
||||
Menu.setApplicationMenu(null)
|
||||
win.loadURL(`file://${__dirname}/index.html#local_token=${pxt.globalConfig.localToken}`)
|
||||
win.on('closed', () => {
|
||||
win = null
|
||||
})
|
||||
}
|
||||
|
||||
app.on('ready', startServerAndCreateWindow)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (win === null) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"name" : "code-the-microbit",
|
||||
"version" : "1.0.0",
|
||||
"description": "Blocks / Javascript editor",
|
||||
"author": "Microsoft",
|
||||
"main" : "main.js",
|
||||
"scripts": {
|
||||
"start": "node_modules/.bin/electron ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "*",
|
||||
"pxt-microbit": "*"
|
||||
}
|
||||
}
|
59
cmds/cmds.ts
@ -1,59 +0,0 @@
|
||||
/// <reference path="../node_modules/pxt-core/built/pxt.d.ts"/>
|
||||
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as child_process from "child_process";
|
||||
|
||||
let writeFileAsync: any = Promise.promisify(fs.writeFile)
|
||||
let execAsync: (cmd: string, options?: { cwd?: string }) => Promise<Buffer> = Promise.promisify(child_process.exec)
|
||||
let readDirAsync = Promise.promisify(fs.readdir)
|
||||
|
||||
|
||||
export function deployCoreAsync(res: ts.pxtc.CompileResult) {
|
||||
return getBitDrivesAsync()
|
||||
.then(drives => {
|
||||
if (drives.length == 0) {
|
||||
console.log("cannot find any drives to deploy to");
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
|
||||
console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", "));
|
||||
|
||||
let writeHexFile = (filename: string) => {
|
||||
return writeFileAsync(filename + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX])
|
||||
.then(() => console.log("wrote hex file to " + filename));
|
||||
};
|
||||
|
||||
return Promise.map(drives, d => writeHexFile(d))
|
||||
.then(() => drives.length);
|
||||
});
|
||||
}
|
||||
|
||||
function getBitDrivesAsync(): Promise<string[]> {
|
||||
if (process.platform == "win32") {
|
||||
const rx = new RegExp("^([A-Z]:).* " + pxt.appTarget.compile.deployDrives)
|
||||
return execAsync("wmic PATH Win32_LogicalDisk get DeviceID, VolumeName, FileSystem")
|
||||
.then(buf => {
|
||||
let res: string[] = []
|
||||
buf.toString("utf8").split(/\n/).forEach(ln => {
|
||||
let m = rx.exec(ln)
|
||||
if (m) {
|
||||
res.push(m[1] + "/")
|
||||
}
|
||||
})
|
||||
return res
|
||||
})
|
||||
}
|
||||
else if (process.platform == "darwin") {
|
||||
const rx = new RegExp(pxt.appTarget.compile.deployDrives)
|
||||
return readDirAsync("/Volumes")
|
||||
.then(lst => lst.filter(s => rx.test(s)).map(s => "/Volumes/" + s + "/"))
|
||||
} else if (process.platform == "linux") {
|
||||
const rx = new RegExp(pxt.appTarget.compile.deployDrives)
|
||||
const user = process.env["USER"]
|
||||
return readDirAsync(`/media/${user}`)
|
||||
.then(lst => lst.filter(s => rx.test(s)).map(s => `/media/${user}/${s}/`))
|
||||
} else {
|
||||
return Promise.resolve([])
|
||||
}
|
||||
}
|
7
cmds/pxtrequire.ts
Normal file
@ -0,0 +1,7 @@
|
||||
/// <reference path="../node_modules/pxt-core/typings/globals/node/index.d.ts"/>
|
||||
/// <reference path="../node_modules/pxt-core/built/pxtlib.d.ts" />
|
||||
|
||||
import * as path from "path";
|
||||
export let pxtCore = require("pxt-core");
|
||||
// require.resolve() gives path to [pxt dir]/built/pxt.js, so move up twice to get pxt root dir
|
||||
export let pxtCoreDir = path.resolve(require.resolve("pxt-core"), "..", "..");
|
@ -1,6 +1,6 @@
|
||||
# Blocks language
|
||||
|
||||
### @description Langugage constructs for the Block editor.
|
||||
### @description Language constructs for the Block editor.
|
||||
|
||||
```namespaces
|
||||
for (let i = 0;i<5;++i) {}
|
||||
@ -11,4 +11,4 @@ Math.random(5);
|
||||
|
||||
## See Also
|
||||
|
||||
[logic](/blocks/logic), [loops](/blocks/loops), [math](/blocks/math), [variables](/blocks/variables)
|
||||
[logic](/blocks/logic), [loops](/blocks/loops), [math](/blocks/math), [variables](/blocks/variables), [on-start](/blocks/on-start)
|
@ -86,12 +86,14 @@ if (led.point(1,1) && led.point(2,2)) {
|
||||
When you compare two Numbers, you get a Boolean value, such as the comparison `x < 5` in the code below:
|
||||
|
||||
```blocks
|
||||
let x = Math.random(5)
|
||||
if(x < 5) {
|
||||
basic.showString("low");
|
||||
} else {
|
||||
basic.showString("high");
|
||||
}
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
let x = Math.random(5)
|
||||
if(x < 5) {
|
||||
basic.showString("low");
|
||||
} else {
|
||||
basic.showString("high");
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
See the documentation on [Numbers](/reference/types/number) for more information on comparing two Numbers. You can also [compare strings](/reference/types/string-functions) using the `equals` function.
|
||||
|
@ -14,13 +14,15 @@ Click on the dark blue gear icon (see above) to add an *else* or *if* to the cur
|
||||
|
||||
### Example: adjusting screen brightness
|
||||
|
||||
```blocks
|
||||
if(input.lightLevel()<100){
|
||||
led.setBrightness(255);
|
||||
}
|
||||
```
|
||||
If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255` when the button A is pressed:
|
||||
|
||||
If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255`:
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
if(input.lightLevel()<100){
|
||||
led.setBrightness(255);
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
|
@ -4,14 +4,21 @@
|
||||
|
||||
Run part of the program the number of times you say.
|
||||
|
||||
```block
|
||||
for(let i = 0; i <= 4; ++i) {
|
||||
}
|
||||
```
|
||||
|
||||
### Example: Count to 4
|
||||
|
||||
This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen.
|
||||
|
||||
```blocks
|
||||
for(let i = 0; i < 5; ++i) {
|
||||
basic.showNumber(i)
|
||||
}
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
for(let i = 0; i < 5; ++i) {
|
||||
basic.showNumber(i)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### See also
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Repeat code while a [Boolean](/blocks/logic/boolean) `condition` is true.
|
||||
|
||||
```blocks
|
||||
```block
|
||||
while(true) {
|
||||
}
|
||||
```
|
||||
@ -16,11 +16,13 @@ The condition is tested before any code runs. Which means that if the condition
|
||||
The following example uses a while loop to make a diagonal line on the LED screen (points `0, 0`, `1, 1`, `2, 2`, `3, 3`, `4, 4`).
|
||||
|
||||
```blocks
|
||||
let index = 4;
|
||||
while(index >= 0) {
|
||||
led.plot(index, index);
|
||||
index--;
|
||||
}
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
let index = 4;
|
||||
while(index >= 0) {
|
||||
led.plot(index, index);
|
||||
index--;
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### See also
|
||||
|
22
docs/blocks/on-start.md
Normal file
@ -0,0 +1,22 @@
|
||||
# On Start
|
||||
|
||||
An event that runs when the program starts.
|
||||
|
||||
The ``on start`` is a special event that runs when the program starts, before any other event.
|
||||
Use this event to initialize your program.
|
||||
|
||||
## Example
|
||||
|
||||
In this example, ``on start`` sets a dimmer brightness on the screen and the button handler shows a string.
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showString("Hello!")
|
||||
})
|
||||
led.setBrightness(50)
|
||||
```
|
||||
|
||||
|
||||
## What about JavaScript?
|
||||
|
||||
``on-start`` only exists in the block editor. In JavaScript, all code executes sequentially from the first line.
|
@ -33,7 +33,7 @@ basic.forever(() => {
|
||||
|
||||
When this program runs, you will see a smiley face, then a blank
|
||||
screen, then a smiley again -- it never stops! (That's because of the
|
||||
``forever`` block.)
|
||||
`[basic.forever(() => {})]` block.)
|
||||
|
||||
Click **Download** to move your program to the @boardname@!
|
||||
Make sure to follow the instructions.
|
||||
|
@ -17,7 +17,7 @@ input.onButtonPressed(Button.A, () => {
|
||||
|
||||
#### ~hint
|
||||
|
||||
The ``showString`` block can show letters, numbers, and punctuation
|
||||
The `[basic.showString("HI")]` block can show letters, numbers, and punctuation
|
||||
on the @boardname@ screen.
|
||||
|
||||
#### ~
|
||||
@ -33,7 +33,7 @@ input.onButtonPressed(Button.B, () => {
|
||||
#### ~hint
|
||||
|
||||
You can find the letter `B` by clicking the letter `A` on the
|
||||
``onButtonPressed`` block.
|
||||
`[input.onButtonPressed(Button.A, () => {})]` block.
|
||||
|
||||
#### ~
|
||||
|
||||
|
@ -23,8 +23,8 @@ input.onButtonPressed(Button.B, () => {
|
||||
```
|
||||
### ~hint
|
||||
|
||||
The ``pick random true or false`` block randomly tells the ``if``
|
||||
block `true` or `false`. If the ``pick`` block picked `true`, the
|
||||
The `[Math.randomBoolean()]` block randomly tells the ``if``
|
||||
block `true` or `false`. If value picked is `true`, the
|
||||
``if`` block shows the letter `H`. Otherwise, it shows the letter `T`.
|
||||
|
||||
That's it!
|
||||
|
@ -9,7 +9,7 @@ There are 25 bright LEDs on the @boardname@ screen. Let's use them to create som
|
||||
### Happy unhappy face
|
||||
|
||||
Draw an unhappy face instead of the blank screen. Click on the dots
|
||||
in the second ``show leds`` block until it matches the blocks below.
|
||||
in the second `[basic.showLeds("")]` block until it matches the blocks below.
|
||||
Now you have an **animation** (cartoon) that shows a happy face,
|
||||
then an unhappy one, then a happy one again, forever (or until
|
||||
you turn off your @boardname@)!
|
||||
@ -36,7 +36,7 @@ Click **Download** to move your program to the @boardname@!
|
||||
|
||||
### Your turn!
|
||||
|
||||
Pile up more ``show leds`` blocks to create an animation! Create an
|
||||
Pile up more `[basic.showLeds("")]` blocks to create an animation! Create an
|
||||
animation with at least 5 pictures. What does this animation show?
|
||||
|
||||
```blocks
|
||||
@ -87,12 +87,6 @@ basic.forever(() => {
|
||||
```
|
||||
Click **Download** to move your program to the @boardname@!
|
||||
|
||||
#### ~hint
|
||||
|
||||
You can find the ``show leds`` block in the **Basic** part of the editor.
|
||||
|
||||
#### ~
|
||||
|
||||
### ~button /getting-started/buttons
|
||||
NEXT: BUTTONS
|
||||
### ~
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"appref": "v0.5.33"
|
||||
"appref": "v0.6.36"
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ Fun games to build with your @boardname@.
|
||||
"imageUrl":"/static/mb/projects/wallet.png"
|
||||
}, {
|
||||
"name": "Watch",
|
||||
"url":"/projects/the-watch",
|
||||
"url":"/projects/watch",
|
||||
"imageUrl":"/static/mb/projects/a10-watch.png"
|
||||
}]
|
||||
```
|
||||
@ -66,6 +66,10 @@ Fun games to build with your @boardname@.
|
||||
|
||||
```codecard
|
||||
[{
|
||||
"name": "Inchworm",
|
||||
"url":"/projects/inchworm",
|
||||
"imageUrl":"/static/mb/projects/inchworm.jpg"
|
||||
}, {
|
||||
"name": "Timing gates",
|
||||
"url":"/projects/timing-gates",
|
||||
"imageUrl":"/static/mb/projects/timing-gates.jpg"
|
||||
@ -92,4 +96,4 @@ Fun games to build with your @boardname@.
|
||||
|
||||
### 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), [Guitar](/projects/guitar), [Watch](/projects/the-watch)
|
||||
[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), [Guitar](/projects/guitar), [Wallet](/projects/wallet), [Watch](/projects/watch)
|
@ -10,12 +10,10 @@ Welcome! This guided tutorial will show you how to program a script that display
|
||||
|
||||
### ~
|
||||
|
||||
|
||||
## Step 1
|
||||
|
||||
Create a loop that will continuously update the reading of the compass.
|
||||
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
|
||||
|
@ -1,26 +1,8 @@
|
||||
# flashing heart
|
||||
|
||||

|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
```sim
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.pause(500);
|
||||
})
|
||||
```
|
||||
|
||||
Use the LEDs to display a flashing heart, and then create
|
||||
an animation of a broken heart. :(
|
||||
Use the LEDs to display a flashing heart!
|
||||
|
||||
### ~
|
||||
|
||||
@ -55,19 +37,19 @@ basic.clearScreen();
|
||||
|
||||
## Step 3
|
||||
|
||||
Put a [forever loop](/reference/basic/forever) around it.
|
||||
Put a [forever loop](/reference/basic/forever) around it to repeat the animation.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
})
|
||||
```
|
||||
|
||||
@ -77,45 +59,50 @@ Add a [pause](/reference/basic/pause) to wait after clearing the screen.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.pause(500);
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.pause(500);
|
||||
})
|
||||
```
|
||||
|
||||
## Step 5
|
||||
## Send your heartbeats over radio!
|
||||
|
||||
Add a second image of a broken heart.
|
||||
Do you have a second @boardname@ at hand? You could use radio and send your heartbeats to other
|
||||
@boardname@ and show a heart when you receive one.
|
||||
|
||||
* move the code in the **forever** inside
|
||||
a [on data packet received](/reference/radio/on-data-packet-received) handler.
|
||||
The handler will run whenever a message is received from another @boardname@.
|
||||
* use [send number](/reference/radio/send-number) and [pause](/reference/basic/pause)
|
||||
to broadcast a packet of data every second.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.pause(500);
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# . # # #
|
||||
# . . . #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.pause(500);
|
||||
radio.sendNumber(0)
|
||||
basic.pause(1000)
|
||||
})
|
||||
radio.onDataPacketReceived(({receivedNumber}) => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
basic.pause(500)
|
||||
basic.clearScreen()
|
||||
basic.pause(500)
|
||||
})
|
||||
```
|
||||
|
||||
Download the .hex file onto both @boardname@ and try it out!
|
||||
|
||||
```package
|
||||
radio
|
||||
```
|
@ -1,7 +1,5 @@
|
||||
# Guitar
|
||||
|
||||

|
||||
|
||||
### @description A beginner-intermediate maker activity, building a guitar with the @boardname@
|
||||
|
||||
### ~avatar avatar
|
||||
@ -9,7 +7,7 @@
|
||||
Make a @boardname@ guitar with this guided tutorial!
|
||||
|
||||
### ~
|
||||
*playing @boardname@ guitar*
|
||||
|
||||
https://youtu.be/GYmdTFvxz80
|
||||
|
||||
## Duration
|
||||
|
@ -19,17 +19,17 @@ Build your own music player @boardname@ from headphones.
|
||||
* Headphones
|
||||
* Crocodile clips
|
||||
|
||||
## Activities
|
||||
|
||||
* [Connect your headphone](/projects/hack-your-headphones/make)
|
||||
* [Play sounds!]()
|
||||
|
||||
# ~hint
|
||||
|
||||
**No crocodile clips!?!?!** Use wires or Aluminium foil! [Read more...](/device/foil-circuits)
|
||||
|
||||
# ~
|
||||
|
||||
## Activities
|
||||
|
||||
* [Connect your headphone](/projects/hack-your-headphones/make)
|
||||
* [Play sounds!]()
|
||||
|
||||
### ~button /projects/hack-your-headphones/make
|
||||
|
||||
Let's get started!
|
||||
|
@ -10,7 +10,9 @@ Let's start by adding a variable where you can store data. Then rename the varia
|
||||
|
||||
|
||||
```blocks
|
||||
let light = input.lightLevel();
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
let light = input.lightLevel();
|
||||
});
|
||||
```
|
||||
|
||||
We want to play music on button pressed in order to register an event handler that will execute whenever when you run a script and click on button pressed on the simulator. We must start by opening the Input drawer and adding `on button pressed` A. Then add a block `rest` to plays nothing for a `1/16` beat. Modify your code so that your code looks like this.
|
||||
|
40
docs/projects/inchworm.md
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
# Inchworm
|
||||
|
||||
### @description A inchworm like robot built with the micro:bit
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
Make a funny inchworm robot!
|
||||
|
||||
### ~
|
||||
|
||||
https://youtu.be/BiZLjugXMbM
|
||||
|
||||
## Duration
|
||||
|
||||
3 Activities, approx 30-45 min each based on familiarity with the coding concepts
|
||||
|
||||
## Materials
|
||||
|
||||
* Cardboard pieces (recycle!)
|
||||
* Glue gun or Tape (masking, duct tape, and/or packing tape)
|
||||
* Scissors that can cut cardboard
|
||||
* 1 @boardname@, battery holder and 2 AAA batteries
|
||||
* 3 Crocodile clips
|
||||
* 1 micro servo 9g SG90
|
||||
* 1 paper clip
|
||||
|
||||

|
||||
|
||||
## Activities
|
||||
|
||||
* [Servo](/projects/inchworm/servo)
|
||||
* [Chassis](/projects/inchworm/chassis)
|
||||
* [Code](/projects/inchworm/code)
|
||||
|
||||
### ~button /projects/inchworm/servo
|
||||
|
||||
Let's get started!
|
||||
|
||||
### ~
|
88
docs/projects/inchworm/chassis.md
Normal file
@ -0,0 +1,88 @@
|
||||
# Chassis
|
||||
### @description Building the cardboard inchworm
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
Turn a piece of cardboard into an inchworm!
|
||||
|
||||
### ~
|
||||
|
||||
## Duration: ~45 minutes
|
||||
|
||||
## Materials
|
||||
* Cardboard
|
||||
* Scissors or cutters
|
||||
* glue gun or tape
|
||||
* 1 paper clip
|
||||
|
||||
## Step 1: cardboard
|
||||
|
||||
Cutout a cardboard rectangle. You can use the @boardname@ as a ruler to figure out the size.
|
||||
|
||||

|
||||
|
||||
## Step 2: center fold
|
||||
|
||||
Fold the cardboard in half over the short edge.
|
||||
|
||||

|
||||
|
||||
## Step 3: legs
|
||||
|
||||
Fold each end so they rest flat on the ground.
|
||||
|
||||

|
||||
|
||||
## Step 4: front teeth
|
||||
|
||||
Fold each corners on one end of the cardbard. This will be the front of the inchworm which is supposed to grip the ground.
|
||||
|
||||

|
||||
|
||||
## Step 5: back teeth
|
||||
|
||||
Using a scissor or a cutter (watch the fingers!), cut out various strips in the other edge. Fold one after the other.
|
||||
|
||||

|
||||
|
||||
## Step 6: mounting the board
|
||||
|
||||
Using tape or a glue gun, mount the @boardname@ on one side and the microservo on the cardobard.
|
||||
|
||||

|
||||
|
||||
## Step 7: mounting the servo
|
||||
|
||||
Attach the servo on the **edge** of the other cardboard side.
|
||||
|
||||

|
||||
|
||||
## Step 8: Cable clean up (optional)
|
||||
|
||||
Use tape to route the cables nicely on the inchworm.
|
||||
|
||||

|
||||
|
||||
## Step 9: attaching paper clip to servo
|
||||
|
||||
Unfold a paper clip and attach it to the servo arm.
|
||||
|
||||

|
||||
|
||||
## Step 10: attaching paper clip to cardboard
|
||||
|
||||
Slide the folder paper clip into the cardboard, and use tape to secure it.
|
||||
You might need to toy around with the size of the clip so that the servo rotation opens the inchworm sufficiently.
|
||||
|
||||

|
||||
|
||||
|
||||
## Step 11: it's ready!
|
||||
|
||||
Your inchworm is ready!
|
||||
|
||||

|
||||
|
||||
### ~button /projects/inchworm/code
|
||||
NEXT: Code
|
||||
### ~
|
48
docs/projects/inchworm/code.md
Normal file
@ -0,0 +1,48 @@
|
||||
# Code
|
||||
### @description code to make the inchworm alive
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
Add code to make the inchworm move.
|
||||
|
||||
### ~
|
||||
|
||||
## Duration: ~30 minutes
|
||||
|
||||
## Step 1: walk forever
|
||||
|
||||
In order for the inchworm to move, the @boardname@ needs to command the servo to go between ``0`` and ``180`` degrees
|
||||
at a certain pace. In the code below, the user pressed button ``A`` to launch the inchworm.
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
pins.servoWritePin(AnalogPin.P0, 0)
|
||||
basic.pause(500)
|
||||
pins.servoWritePin(AnalogPin.P0, 180)
|
||||
basic.pause(500)
|
||||
});
|
||||
```
|
||||
|
||||
### ~ hint
|
||||
|
||||
You may have noticed that the inchworm can be rather slow or simply won't move. Try to improve the design of your legs, teeth
|
||||
so that the inchworm goes as fast as possible. Trying it on carpet also great helps avoiding skidding.
|
||||
|
||||
### ~
|
||||
|
||||
## Step 2: radio controlled inchworm
|
||||
|
||||
You will need 2 @boardname@ for this part. By using the radio, we can make the inchworm controlled by another @boardname@.
|
||||
Download the code below to the @boardname@ on the inchworm and another "controller" @boardname@. Whenere A is pressed, the inchworm will move once.
|
||||
|
||||
```blocks
|
||||
radio.onDataPacketReceived(({receivedNumber}) => {
|
||||
pins.servoWritePin(AnalogPin.P0, 0)
|
||||
basic.pause(500)
|
||||
pins.servoWritePin(AnalogPin.P0, 180)
|
||||
basic.pause(500)
|
||||
})
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
radio.sendNumber(0)
|
||||
})
|
||||
```
|
130
docs/projects/inchworm/servo.md
Normal file
@ -0,0 +1,130 @@
|
||||
# Preparing the servo
|
||||
### @description Connecting the servo to crocodile clips
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
Equip the microservo with crocodile clips.
|
||||
|
||||
### ~
|
||||
|
||||
## Duration: ~30 minutes
|
||||
|
||||
## Materials
|
||||
* Cutting pliers or wire cutter
|
||||
* Tape (masking, duct tape, and/or packing tape)
|
||||
* 3 crocodile clips, yellow, red and black.
|
||||
* 1 micro servo 9g (SG90)
|
||||
|
||||
## Using a microservo with the @boardname@
|
||||
|
||||
The @boardname@ provides just enough current to operate the SG90 microservo.
|
||||
The servo requires 3 connections: GND, 3V and a logic pin.
|
||||
In this tutorial, we will equip the servo with crocodile clips to make it easier to use.
|
||||
However, you could also use a shield or female to crocodile clips to acheive the same effect.
|
||||
|
||||
If you are running a class or activity, you should consider preparing all servos before hand.
|
||||
|
||||
### ~ hint
|
||||
|
||||
Kitronik wrote an excellent in-depth guide about using servos with the @boardname@.
|
||||
Check it out at https://www.kitronik.co.uk/blog/using-bbc-microbit-control-servo/ .
|
||||
|
||||
### ~
|
||||
|
||||
## Step 1: cutout the connector
|
||||
|
||||
Using the cutting pliers, cut out the dark plastic connector.
|
||||
|
||||

|
||||
|
||||
## Step 2: strip out cables
|
||||
|
||||
Using the plier or a wire stripper, strip the plastic from the cables.
|
||||
|
||||

|
||||
|
||||
## Step 3: threading the servo cablers
|
||||
|
||||
Thread the servo cables.
|
||||
|
||||

|
||||
|
||||
## Step 4: crocobile clip claps
|
||||
|
||||
Cut a crocodile cable in two and strip out the casing.
|
||||
If possible try to use the same cable colors as the servo!
|
||||
|
||||

|
||||
|
||||
## Step 5: thread cables together
|
||||
|
||||
Place the cables next to each other
|
||||
|
||||

|
||||
|
||||
... and thread them together.
|
||||
|
||||

|
||||
|
||||
### ~ hint
|
||||
|
||||
It is very **important** to ensure that there is a good connection between the 2 cables.
|
||||
If the connection is weak, the microservo will not receive enough current and it will not work.
|
||||
If you have access to a soldering iron, we strongly recommend to solver this connection.
|
||||
|
||||
### ~
|
||||
|
||||
## Step 4: protect the connection
|
||||
|
||||
Protect the connection with electrical or duct tape.
|
||||
|
||||

|
||||
|
||||
## Step 5: repeat for all cables
|
||||
|
||||
Repeat the same process until all cables are connected.
|
||||
|
||||

|
||||
|
||||
## Step 6: testing!
|
||||
|
||||
It's time to test that your connection are all proper and that the servo will function **when the @boardname@ is powered by battery**.
|
||||
|
||||
* Connect the microservo to the @boardname@. Black cable on ``GND``, red cable on ``3V`` and remaining cable on ``P0``.
|
||||
|
||||

|
||||
|
||||
### ~ hint
|
||||
|
||||
When attaching the crocodile clips to the pins, don't hesitate to grab the side of the board with the jaws.
|
||||
|
||||

|
||||
|
||||
### ~
|
||||
|
||||
* Download the following code to your @boardname@
|
||||
|
||||
```blocks
|
||||
let a = 0
|
||||
basic.forever(() => {
|
||||
a = input.acceleration(Dimension.X)
|
||||
pins.servoWritePin(AnalogPin.P0, pins.map(
|
||||
a,
|
||||
-512,
|
||||
512,
|
||||
0,
|
||||
180
|
||||
))
|
||||
})
|
||||
```
|
||||
|
||||
* When powered by USB, make sure that the servo moves when you tilt the board.
|
||||
* When powered by batteries **only**, make sure that the servo moves when you tilt the board.
|
||||
|
||||
If your servo seems to sutter and stay stuck at a particular position, it means that it is not receiving enough power.
|
||||
This is probably due to a weak connection or low battery level. Check each connection and check your batteries.
|
||||
|
||||
|
||||
### ~button /projects/inchworm/chassis
|
||||
NEXT: Chassis
|
||||
### ~
|
@ -1,8 +1,10 @@
|
||||
# love meter
|
||||
|
||||

|
||||
### ~avatar avatar
|
||||
|
||||
Use pins P0, P1 and P2 to change the display by creating a circuit with your body.
|
||||
Use pins and your body to change the display!
|
||||
|
||||
### ~
|
||||
|
||||
## Step 1
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
# magic button trick
|
||||
|
||||
Perform a magic trick where you appear to make the **A** and **B** button of your @boardname@ swap over just by moving a sticky label.
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
Welcome! This activity will teach you how to use the @boardname@'s compass to detect a nearby magnet
|
||||
Build a magic trick that uses the @boardname@'s compass to detect a nearby magnet!
|
||||
|
||||
### ~
|
||||
This is a simple magic trick you can perform to amaze your friends, where by moving the sticky labels on your @boardname@'s **A** and **B** button you appear to make the buttons really switch over. To see the trick performed watch the video below.
|
||||
@ -39,7 +37,7 @@ input.onButtonPressed(Button.B, () => {
|
||||
|
||||
We will use the @boardname@'s compass to detect the magnet. Compass's tell us what direction we are pointing by detecting the Earth's magnetic field but they can also detect any other magnet nearby. We will use that to check if our magnet is next to the @boardname@ by using the [magnetic force](/reference/input/magnetic-force) block found in the input menu's 'more' section. As we only want to measure the strength we change the drop down to select 'strength':
|
||||
|
||||
```blocks
|
||||
```block
|
||||
input.magneticForce(Dimension.Strength)
|
||||
```
|
||||
|
||||
@ -52,16 +50,19 @@ If you have ever played with magnets you know they have two ends, often called a
|
||||
So in the code below we will check if the absolute value of our magnetic field strength reading is more than 100 and save the result of that check in a new variable called 'isSwitched':
|
||||
|
||||
```blocks
|
||||
let isSwitched = Math.abs(input.magneticForce(Dimension.Strength)) > 100
|
||||
let force = Math.abs(input.magneticForce(Dimension.Strength));
|
||||
let isSwitched = force > 100
|
||||
```
|
||||
## Step 4: running our 'magnet nearby' check all the time
|
||||
|
||||
At the moment our code to detect the magnet being nearby will only run once so we need to put it into a [forever](/reference/basic/forever) block so that it keeps getting run again and again checking for the magnet to come near to the @boardname@. We should also make sure 'isSwitched' is false when our program starts.
|
||||
|
||||
```blocks
|
||||
let force = 0;
|
||||
let isSwitched = false;
|
||||
basic.forever(() => {
|
||||
let isSwitched = Math.abs(input.magneticForce(Dimension.Strength)) > 100
|
||||
force = Math.abs(input.magneticForce(Dimension.Strength));
|
||||
isSwitched = force > 100
|
||||
})
|
||||
```
|
||||
|
||||
@ -70,10 +71,11 @@ basic.forever(() => {
|
||||
Now we can check the value of our variable 'isSwitched' whenever we want and we will know that the magnet is nearby if it's value is 'true'. Let's use that to change how the buttons work and complete the code for our trick. We will add an 'if, else' block to each button's code and check if we should swap over what each button displays because 'isSwitched' is equal to true:
|
||||
|
||||
```blocks
|
||||
|
||||
let force = 0;
|
||||
let isSwitched = false;
|
||||
basic.forever(() => {
|
||||
isSwitched = Math.abs(input.magneticForce(Dimension.Strength)) > 100
|
||||
force = Math.abs(input.magneticForce(Dimension.Strength));
|
||||
isSwitched = force > 100
|
||||
})
|
||||
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
|
@ -1,51 +1,11 @@
|
||||
# rock paper scissors
|
||||
|
||||

|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
```sim
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
let img = Math.random(3)
|
||||
if (img == 0) {
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# . . . #
|
||||
# . . . #
|
||||
# . . . #
|
||||
# # # # #
|
||||
`)
|
||||
|
||||
} else if (img == 1) {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # # # .
|
||||
. # # # .
|
||||
. # # # .
|
||||
. . . . .
|
||||
`)
|
||||
} else {
|
||||
basic.showLeds(`
|
||||
# # . . #
|
||||
# # . # .
|
||||
. . # . .
|
||||
# # . # .
|
||||
# # . . #
|
||||
`)
|
||||
}
|
||||
})
|
||||
```
|
||||
In this project, you will build a Rock Paper Scissors game with the @boardname@.
|
||||
You can play the game with a friend who has it on a @boardname@.
|
||||
You can also play it with friends who are just using their hands.
|
||||
Build a rock paper scissors game!
|
||||
|
||||
### ~
|
||||
|
||||
|
||||
## Materials needed
|
||||
|
||||
* Your @boardname@ -- that's it!
|
||||
|
||||
## Step 1: Getting started
|
||||
|
||||
We want the @boardname@ to choose rock, paper, or scissors when you shake it.
|
||||
|
@ -1,8 +1,10 @@
|
||||
# smiley buttons
|
||||
|
||||

|
||||
### ~avatar
|
||||
|
||||
Use buttons to show a smiley or frowny face.
|
||||
Use buttons to show a smiley face!
|
||||
|
||||
### ~
|
||||
|
||||
## Step 1
|
||||
|
||||
@ -10,8 +12,8 @@ Use [show leds](/reference/basic/show-leds) to make a smiley face:
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
# # . # #
|
||||
# # . # #
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`
|
||||
@ -20,56 +22,93 @@ basic.showLeds(`
|
||||
|
||||
## Step 2
|
||||
|
||||
Add an input block for when [button A is pressed](/reference/input/button-is-pressed), and put a
|
||||
frowny face inside it:
|
||||
Add an input block for when [button A is pressed](/reference/input/button-is-pressed),
|
||||
and **move** the smiley face inside it:
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`
|
||||
);
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #`
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
## Step 3
|
||||
|
||||
Now add blocks so that when [button B is pressed](/reference/input/button-is-pressed), a smiley appears:
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`
|
||||
);
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #`
|
||||
);
|
||||
});
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
# # . # #
|
||||
# # . # #
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
Try pressing button A!
|
||||
|
||||
## Step 3
|
||||
|
||||
Now add blocks so that when [button B is pressed](/reference/input/on-button-pressed),
|
||||
a frowney appears:
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showLeds(`
|
||||
# # . # #
|
||||
# # . # #
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`
|
||||
);
|
||||
});
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showLeds(`
|
||||
# # . # #
|
||||
# # . # #
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #`
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
Try pressing ``A`` or ``B``!
|
||||
|
||||
## Send your smileys over radio
|
||||
|
||||
Do you have a second @boardname@ at hand? You could use radio and send your smileys or frownies to other
|
||||
@boardname@.
|
||||
|
||||
Since radio can send numbers, we decide that ``0`` is the code for displaying a smiley
|
||||
and ``1`` is the code for a frowney.
|
||||
|
||||
Change your code as follows:
|
||||
* [radio send number](/reference/radio/send-number) sends a number
|
||||
to any other @boardname@ in range
|
||||
* [radio on data packet received](/reference/radio/on-data-packet-received) runs code
|
||||
when data is received over radio
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
radio.sendNumber(0)
|
||||
})
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
radio.sendNumber(1)
|
||||
})
|
||||
radio.onDataPacketReceived(({receivedNumber}) => {
|
||||
if (receivedNumber == 0) {
|
||||
basic.showLeds(`
|
||||
# # . # #
|
||||
# # . # #
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .
|
||||
`)
|
||||
} else {
|
||||
basic.showLeds(`
|
||||
# # . # #
|
||||
# # . # #
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #
|
||||
`)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
```package
|
||||
radio
|
||||
```
|
||||
|
@ -1,7 +1,5 @@
|
||||
# Wallet
|
||||
|
||||

|
||||
|
||||
### @description A beginner maker activity, building a duct tape wallet with the @boardname@
|
||||
|
||||
### ~avatar avatar
|
||||
@ -12,23 +10,6 @@ Make a @boardname@ wallet with this guided tutorial!
|
||||
|
||||

|
||||
|
||||
## Duration
|
||||
|
||||
2 Activities, approx 30-45 min each based on familiarity with the coding concepts
|
||||
|
||||
## Materials
|
||||
|
||||
* Paper sheet
|
||||
* Tape (masking, duct tape, and/or packing tape)
|
||||
* Scissors
|
||||
* 1 @boardname@, battery holder and 2 AAA batteries
|
||||
* Marker or pen
|
||||
|
||||
## Activities
|
||||
|
||||
* [Make](/projects/wallet/make)
|
||||
* [Code](/projects/wallet/code)
|
||||
|
||||
### ~button /projects/wallet/make
|
||||
|
||||
Let's get started!
|
||||
|
20
docs/projects/watch.md
Normal file
@ -0,0 +1,20 @@
|
||||
# the watch
|
||||
|
||||
### ~avatar
|
||||
|
||||
Build your own @boardname@ watch from an old pair of jeans and T-shirt!
|
||||
|
||||
### ~
|
||||
|
||||

|
||||
|
||||
### ~button /projects/watch/make
|
||||
|
||||
Let's get started!
|
||||
|
||||
### ~
|
||||
|
||||
### Acknowledgements
|
||||
|
||||
Artistic design by Melinda Hoeneisen.
|
||||
|
@ -1,12 +1,14 @@
|
||||

|
||||
# the watch - Make
|
||||
|
||||
# the watch
|
||||
### @description Maker Project for Watch
|
||||
|
||||

|
||||
### ~avatar avatar
|
||||
|
||||
In this project, you will build your own wearable @boardname@ watch from an old pair of jeans and T-shirt. Project duration: 15 minutes.
|
||||
Make a watch for your @boardname@
|
||||
|
||||

|
||||
### ~
|
||||
|
||||
## Duration: ~30 minutes
|
||||
|
||||
## Materials
|
||||
|
||||
@ -147,8 +149,3 @@ Trim any leftover fabric, threads or tape.
|
||||

|
||||
|
||||
Your watch is ready!
|
||||
|
||||
### Acknowledgements
|
||||
|
||||
Artistic design by Melinda Hoeneisen.
|
||||
|
@ -30,7 +30,7 @@ control.inBackground(() => {
|
||||
```
|
||||
|
||||
## Bluetooth
|
||||
|
||||
|
||||
```namespaces
|
||||
devices.tellCameraTo(MesCameraEvent.TakePhoto);
|
||||
bluetooth.onBluetoothConnected(() => {});
|
||||
|
@ -18,15 +18,15 @@ and updates the screen with the direction.
|
||||
basic.forever(() => {
|
||||
let heading = input.compassHeading()
|
||||
if (heading < 45) {
|
||||
basic.showString("N", 100)
|
||||
basic.showString("N")
|
||||
} else if (heading < 135) {
|
||||
basic.showString("E", 100)
|
||||
basic.showString("E")
|
||||
}
|
||||
else if (heading < 225) {
|
||||
basic.showString("S", 100)
|
||||
basic.showString("S")
|
||||
}
|
||||
else {
|
||||
basic.showString("W", 100)
|
||||
basic.showString("W")
|
||||
}
|
||||
})
|
||||
```
|
||||
@ -40,7 +40,7 @@ You can use a program like this to count things with your @boardname@.
|
||||
```blocks
|
||||
let num = 0
|
||||
basic.forever(() => {
|
||||
basic.showNumber(num, 150)
|
||||
basic.showNumber(num)
|
||||
})
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
num = num + 1
|
||||
@ -56,10 +56,10 @@ Try this on your @boardname@:
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
basic.showNumber(6789, 150)
|
||||
basic.showNumber(6789)
|
||||
})
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showNumber(2, 150)
|
||||
basic.showNumber(2)
|
||||
})
|
||||
```
|
||||
|
||||
|
@ -19,6 +19,7 @@ bluetooth.startMagnetometerService();
|
||||
bluetooth.startTemperatureService();
|
||||
bluetooth.onBluetoothConnected(() => {});
|
||||
bluetooth.onBluetoothDisconnected(() => {});
|
||||
bluetooth.setTransmitPower(7);
|
||||
```
|
||||
|
||||
## UART
|
||||
@ -31,6 +32,14 @@ bluetooth.uartWriteNumber(0);
|
||||
bluetooth.uartWriteValue("", 0);
|
||||
```
|
||||
|
||||
## Eddystone
|
||||
|
||||
```cards
|
||||
bluetooth.advertiseUid(42, 1, 7, true);
|
||||
bluetooth.advertiseUrl("https://pxt.microbit.org/", 7, true);
|
||||
bluetooth.stopAdvertising();
|
||||
```
|
||||
|
||||
```package
|
||||
bluetooth
|
||||
```
|
||||
@ -47,4 +56,7 @@ For more advanced information on the @boardname@ Bluetooth UART service includin
|
||||
[uartWriteString](/reference/bluetooth/uart-write-string),
|
||||
[uartWriteNumber](/reference/bluetooth/uart-write-number),
|
||||
[uartWriteValue](/reference/bluetooth/uart-write-value),
|
||||
[onBluetoothConnected](/reference/bluetooth/on-bluetooth-connected), [onBluetoothDisconnected](/reference/bluetooth/on-bluetooth-disconnected)
|
||||
[onBluetoothConnected](/reference/bluetooth/on-bluetooth-connected),
|
||||
[onBluetoothDisconnected](/reference/bluetooth/on-bluetooth-disconnected),
|
||||
[advertiseUrl](/reference/bluetooth/advertise-url),
|
||||
[stopAdvertising](/reference/bluetooth/stop-advertising)
|
||||
|
37
docs/reference/bluetooth/advertise-uid-buffer.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Avertise UID Buffer
|
||||
|
||||
Advertises a UID via the Eddystone protocol over Bluetooth.
|
||||
|
||||
## ~hint
|
||||
|
||||
### Eddystone
|
||||
|
||||
Bluetooth beacons are used to indicate proximity to a place or object of interest.
|
||||
Beacons use Bluetooth advertising to broadcast a small amount of data,
|
||||
which can be received and acted upon by anyone in range with a suitable device and software, typically a smartphone and application.
|
||||
|
||||
There are various beacon message formats, which define the way Bluetooth advertising packets are used as containers for beacon data.
|
||||
iBeacon is Apple's beacon message format. Eddystone comes from Google.
|
||||
|
||||
Read more at https://lancaster-university.github.io/microbit-docs/ble/eddystone/ .
|
||||
|
||||
## ~
|
||||
|
||||
```sig
|
||||
bluetooth.advertiseUidBuffer(pins.createBuffer(16), 7, true);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* ``buffer`` - a 16 bytes buffer containing the namespace (first 10 bytes) and instance (last 6 bytes).
|
||||
* ``power`` - a [number](/reference/types/number) representing the power level between 0 (short) and 7 (maximum range).
|
||||
* ``connectable`` - a [boolean](/blocks/logic/boolean) indicating whether or not the micro:bit should accept connections.
|
||||
|
||||
|
||||
## See Also
|
||||
|
||||
[stop-advertising](/reference/bluetooth/stop-advertising), [advertise-uid](/reference/bluetooth/advertise-uid)
|
||||
|
||||
```package
|
||||
bluetooth
|
||||
```
|
46
docs/reference/bluetooth/advertise-uid.md
Normal file
@ -0,0 +1,46 @@
|
||||
# Avertise UID
|
||||
|
||||
Advertises a UID via the Eddystone protocol over Bluetooth.
|
||||
|
||||
## ~hint
|
||||
|
||||
### Eddystone
|
||||
|
||||
Bluetooth beacons are used to indicate proximity to a place or object of interest.
|
||||
Beacons use Bluetooth advertising to broadcast a small amount of data,
|
||||
which can be received and acted upon by anyone in range with a suitable device and software, typically a smartphone and application.
|
||||
|
||||
There are various beacon message formats, which define the way Bluetooth advertising packets are used as containers for beacon data.
|
||||
iBeacon is Apple's beacon message format. Eddystone comes from Google.
|
||||
|
||||
Read more at https://lancaster-university.github.io/microbit-docs/ble/eddystone/ .
|
||||
|
||||
## ~
|
||||
|
||||
```sig
|
||||
bluetooth.advertiseUid(42, 1, 7, true);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* ``namespace`` last 4 bytes of the namespace uid (6 to 9)
|
||||
* ``instance`` last 4 bytes of the instance (2 to 5)
|
||||
* ``power`` - a [number](/reference/types/number) representing the power level between 0 (short) and 7 (maximum range).
|
||||
* ``connectable`` - a [boolean](/blocks/logic/boolean) indicating whether or not the micro:bit should accept connections.
|
||||
|
||||
## Encoding
|
||||
|
||||
The bytes of ``namespace`` and ``instance`` are encoded to generate the 10 bytes UID namespace and 6 bytes UID instance.
|
||||
|
||||
```
|
||||
UID namespace: [0, ..., namespace]
|
||||
UID instance: [0, ..., instance]
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
[stop-advertising](/reference/bluetooth/stop-advertising), [advertise-uid-buffer](/reference/bluetooth/advertise-uid-buffer)
|
||||
|
||||
```package
|
||||
bluetooth
|
||||
```
|
42
docs/reference/bluetooth/advertise-url.md
Normal file
@ -0,0 +1,42 @@
|
||||
# Avertise Url
|
||||
|
||||
Advertises a URL via the Eddystone protocol over Bluetooth.
|
||||
|
||||
## ~hint
|
||||
|
||||
### Eddystone
|
||||
|
||||
Bluetooth beacons are used to indicate proximity to a place or object of interest.
|
||||
Beacons use Bluetooth advertising to broadcast a small amount of data,
|
||||
which can be received and acted upon by anyone in range with a suitable device and software, typically a smartphone and application.
|
||||
|
||||
There are various beacon message formats, which define the way Bluetooth advertising packets are used as containers for beacon data.
|
||||
iBeacon is Apple's beacon message format. Eddystone comes from Google.
|
||||
|
||||
Read more at https://lancaster-university.github.io/microbit-docs/ble/eddystone/ .
|
||||
|
||||
## ~
|
||||
|
||||
```sig
|
||||
bluetooth.advertiseUrl("https://pxt.microbit.org/", 7, true);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* ``url`` - a [string](/reference/types/string) containing the URL to broadcast, at most 17 characters long, excluding the protocol (eg: ``https://``) which gets encoded as 1 byte.
|
||||
* ``power`` - a [number](/reference/types/number) representing the power level between 0 (short) and 7 (maximum range).
|
||||
* ``connectable`` - a [boolean](/blocks/logic/boolean) indicating whether or not the micro:bit should accept connections.
|
||||
|
||||
### Example: Broadcast a secret code
|
||||
|
||||
```blocks
|
||||
bluetooth.advertiseUrl("https://pxt.io?secret=42", 7, true);
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
[stop-advertising](/reference/bluetooth/stop-advertising), [advertise-uid](/reference/bluetooth/advertise-uid)
|
||||
|
||||
```package
|
||||
bluetooth
|
||||
```
|
26
docs/reference/bluetooth/set-transmit-power.md
Normal file
@ -0,0 +1,26 @@
|
||||
# Bluetooth Set Transmit Power
|
||||
|
||||
### ~hint
|
||||

|
||||
|
||||
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
|
||||
|
||||
### ~
|
||||
|
||||
Change the output power level of the transmitter to the given value.
|
||||
|
||||
```sig
|
||||
bluetooth.setTransmitPower(7);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* `power`: a [number](/reference/types/number) in the range ``0..7``, where ``0`` is the lowest power and ``7`` is the highest.
|
||||
|
||||
### See also
|
||||
|
||||
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
|
||||
|
||||
```package
|
||||
bluetooth
|
||||
```
|
38
docs/reference/bluetooth/stop-advertising.md
Normal file
@ -0,0 +1,38 @@
|
||||
# Stop Advertising
|
||||
|
||||
Stops advertising URL via the Eddystone protocol over Bluetooth.
|
||||
|
||||
## ~hint
|
||||
|
||||
### Eddystone
|
||||
|
||||
Bluetooth beacons are used to indicate proximity to a place or object of interest.
|
||||
Beacons use Bluetooth advertising to broadcast a small amount of data,
|
||||
which can be received and acted upon by anyone in range with a suitable device and software, typically a smartphone and application.
|
||||
|
||||
There are various beacon message formats, which define the way Bluetooth advertising packets are used as containers for beacon data.
|
||||
iBeacon is Apple's beacon message format. Eddystone comes from Google.
|
||||
|
||||
Read more at https://lancaster-university.github.io/microbit-docs/ble/eddystone/ .
|
||||
|
||||
## ~
|
||||
|
||||
```sig
|
||||
bluetooth.stopAdvertising();
|
||||
```
|
||||
|
||||
### Example: stop advertising on button pressed
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
bluetooth.stopAdvertising();
|
||||
})
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
[advertise-url](/reference/bluetooth/advertise-url)
|
||||
|
||||
```package
|
||||
bluetooth
|
||||
```
|
@ -25,6 +25,15 @@ let freq = music.noteFrequency(Note.C)
|
||||
music.playTone(freq, 1000)
|
||||
```
|
||||
|
||||
|
||||
### Using other pins
|
||||
|
||||
Use [analogSetPitchPin](/reference/pins/analog-set-pitch-pin) to change that pin used to generate music.
|
||||
|
||||
```blocks
|
||||
pins.analogSetPitchPin(AnalogPin.P1);
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
[rest](/reference/music/rest), [ring tone](/reference/music/ring-tone) , [tempo](/reference/music/tempo), [set tempo](/reference/music/set-tempo),
|
||||
|
@ -32,6 +32,14 @@ basic.forever(() => {
|
||||
})
|
||||
```
|
||||
|
||||
### Using other pins
|
||||
|
||||
Use [analogSetPitchPin](/reference/pins/analog-set-pitch-pin) to change that pin used to generate music.
|
||||
|
||||
```blocks
|
||||
pins.analogSetPitchPin(AnalogPin.P1);
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
[rest](/reference/music/rest), [play tone](/reference/music/play-tone),
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Analog Pitch
|
||||
|
||||
Emits a Pulse With Modulation (PWM) signal to the current pitch [pin](/device/pins). Use [analog set pitch pin](/reference/pins/analog-set-pitch-pin) to set the current pitch pin.
|
||||
Emits a Pulse With Modulation (PWM) signal to the pin ``P0``.
|
||||
Use [analog set pitch pin](/reference/pins/analog-set-pitch-pin) to set the current pitch pin.
|
||||
|
||||
```sig
|
||||
pins.analogPitch(440, 300)
|
||||
@ -17,6 +18,7 @@ pins.analogPitch(440, 300)
|
||||
pins.analogSetPitchPin("P0")
|
||||
let frequency1 = 440
|
||||
let duration = 1000
|
||||
pins.analogSetPitchPin(AnalogPin.P1);
|
||||
pins.analogPitch(frequency1, duration)
|
||||
```
|
||||
|
||||
|
28
docs/reference/serial/read-until.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Serial Read Until
|
||||
|
||||
Read a text from the serial port until a delimiter is found.
|
||||
|
||||
```sig
|
||||
serial.readUntil(",");
|
||||
```
|
||||
|
||||
### Returns
|
||||
|
||||
* a [string](/reference/types/string) containing input from the serial port, such as a response typed by a user
|
||||
|
||||
### Example
|
||||
|
||||
The following example reads strings separated by commands (``,``).
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
let answer = serial.readUntil(",");
|
||||
serial.writeLine(answer);
|
||||
});
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
[serial](/device/serial),
|
||||
[serial write line](/reference/serial/write-line),
|
||||
[serial write value](/reference/serial/write-value)
|
BIN
docs/static/Microsoft-logo_rgb_c-white.png
vendored
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
docs/static/mb/projects/inchworm.jpg
vendored
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
docs/static/mb/projects/inchworm/chassis1.jpg
vendored
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
docs/static/mb/projects/inchworm/chassis2.jpg
vendored
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
docs/static/mb/projects/inchworm/chassis3.jpg
vendored
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
docs/static/mb/projects/inchworm/chassis4.jpg
vendored
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
docs/static/mb/projects/inchworm/chassis5.jpg
vendored
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
docs/static/mb/projects/inchworm/chassis6.jpg
vendored
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
docs/static/mb/projects/inchworm/chassis7.jpg
vendored
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
docs/static/mb/projects/inchworm/chassis8.jpg
vendored
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
docs/static/mb/projects/inchworm/circuit1.jpg
vendored
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
docs/static/mb/projects/inchworm/circuit2.jpg
vendored
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
docs/static/mb/projects/inchworm/clip1.jpg
vendored
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
docs/static/mb/projects/inchworm/clip2.jpg
vendored
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
docs/static/mb/projects/inchworm/clip3.jpg
vendored
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
docs/static/mb/projects/inchworm/materials.jpg
vendored
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
docs/static/mb/projects/inchworm/ready.jpg
vendored
Normal file
After Width: | Height: | Size: 84 KiB |
BIN
docs/static/mb/projects/inchworm/servo1.jpg
vendored
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
docs/static/mb/projects/inchworm/servo3.jpg
vendored
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
docs/static/mb/projects/inchworm/servo4.jpg
vendored
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
docs/static/mb/projects/inchworm/servo5.jpg
vendored
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
docs/static/mb/projects/inchworm/servo6.jpg
vendored
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
docs/static/mb/projects/inchworm/servo7.jpg
vendored
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
docs/static/mb/projects/inchworm/servo8.jpg
vendored
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
docs/static/mb/projects/inchworm/servotrim.jpg
vendored
Normal file
After Width: | Height: | Size: 39 KiB |
67
docs/tutorials/getting-started.md
Normal file
@ -0,0 +1,67 @@
|
||||
# Getting started
|
||||
|
||||
### Step 1
|
||||
|
||||
Place blocks in the workspace to scroll text on the screen.
|
||||
|
||||
```blocks
|
||||
basic.showString("Hi!")
|
||||
```
|
||||
|
||||
### Step 2
|
||||
|
||||
Transfer your code in your @boardname@! Click the **Download** button
|
||||
and follow the instructions.
|
||||
|
||||
ANIMATEDGIF
|
||||
|
||||
### Step 3
|
||||
|
||||
Great, the text scrolled! But then it stopped.
|
||||
Let's make it scroll when button **A** is pressed.
|
||||
|
||||
```block
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showString("Hi!")
|
||||
});
|
||||
```
|
||||
|
||||
### Step 4
|
||||
|
||||
Transfer your code in your @boardname@ and try pressing **A**.
|
||||
|
||||
ANIMATEDGIF
|
||||
|
||||
### Step 5
|
||||
|
||||
Place more blocks to display a smiley when button **B** is pressed.
|
||||
Download your code and try it!
|
||||
|
||||
```block
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showLeds(`
|
||||
# # . # #
|
||||
# # . # #
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .
|
||||
`)
|
||||
})
|
||||
```
|
||||
|
||||
### Step 6
|
||||
|
||||
Drag more blocks to display a frownie when @boardname@ is shaken.
|
||||
Download your code and try it!
|
||||
|
||||
```block
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
basic.showLeds(`
|
||||
# # . # #
|
||||
# # . # #
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #
|
||||
`)
|
||||
})
|
||||
```
|
@ -38,7 +38,7 @@ That's it!
|
||||
|
||||
### Installation Instructions
|
||||
|
||||
* Download the [Microsoft.Uploader.Microbit.zip](https://pxt.microbit.org/microbit-uploader.zip) file to your local computer.
|
||||
* Download the [Microsoft.Uploader.Microbit.zip](https://www.touchdevelop.com/microbituploader.zip) file to your local computer.
|
||||
* Unzip the .zip file to your desktop.
|
||||
* Launch the Microsoft.Uploader.exe file before working on your @boardname@.
|
||||
|
||||
|
14
electron/product.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"applicationName": "pxt-microbit-oss",
|
||||
"dataFolderName": ".pxt-microbit-oss",
|
||||
"darwinBundleIdentifier": "com.microsoft.pxtmicrobitoss",
|
||||
"nameShort": "PXT microbit - OSS",
|
||||
"nameLong": "PXT micro:bit - OSS",
|
||||
"targetId": "pxt-microbit",
|
||||
"win32AppId": "{{92db071a-6f58-4938-8c97-13c873f4da13}",
|
||||
"win32AppUserModelId": "Microsoft.PXTmicrobitOss",
|
||||
"win32DirName": "Microsoft PXT microbit - OSS",
|
||||
"win32MutexName": "pxtmicrobitoss",
|
||||
"win32NameVersion": "Microsoft PXT microbit-OSS",
|
||||
"win32RegValueName": "PXTmicrobitOss"
|
||||
}
|
9
electron/release.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": {
|
||||
"0": {
|
||||
"latest": "v0.6.45",
|
||||
"banned": [],
|
||||
"prompt": "v0.0.0"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,62 +1,3 @@
|
||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||
<block type="device_forever">
|
||||
<statement name="HANDLER">
|
||||
<block type="device_show_leds">
|
||||
<field name="LED00">FALSE</field>
|
||||
<field name="LED10">FALSE</field>
|
||||
<field name="LED20">FALSE</field>
|
||||
<field name="LED30">FALSE</field>
|
||||
<field name="LED40">FALSE</field>
|
||||
<field name="LED01">FALSE</field>
|
||||
<field name="LED11">TRUE</field>
|
||||
<field name="LED21">FALSE</field>
|
||||
<field name="LED31">TRUE</field>
|
||||
<field name="LED41">FALSE</field>
|
||||
<field name="LED02">FALSE</field>
|
||||
<field name="LED12">FALSE</field>
|
||||
<field name="LED22">FALSE</field>
|
||||
<field name="LED32">FALSE</field>
|
||||
<field name="LED42">FALSE</field>
|
||||
<field name="LED03">TRUE</field>
|
||||
<field name="LED13">FALSE</field>
|
||||
<field name="LED23">FALSE</field>
|
||||
<field name="LED33">FALSE</field>
|
||||
<field name="LED43">TRUE</field>
|
||||
<field name="LED04">FALSE</field>
|
||||
<field name="LED14">TRUE</field>
|
||||
<field name="LED24">TRUE</field>
|
||||
<field name="LED34">TRUE</field>
|
||||
<field name="LED44">FALSE</field>
|
||||
<next>
|
||||
<block type="device_show_leds">
|
||||
<field name="LED00">FALSE</field>
|
||||
<field name="LED10">FALSE</field>
|
||||
<field name="LED20">FALSE</field>
|
||||
<field name="LED30">FALSE</field>
|
||||
<field name="LED40">FALSE</field>
|
||||
<field name="LED01">FALSE</field>
|
||||
<field name="LED11">FALSE</field>
|
||||
<field name="LED21">FALSE</field>
|
||||
<field name="LED31">FALSE</field>
|
||||
<field name="LED41">FALSE</field>
|
||||
<field name="LED02">FALSE</field>
|
||||
<field name="LED12">FALSE</field>
|
||||
<field name="LED22">FALSE</field>
|
||||
<field name="LED32">FALSE</field>
|
||||
<field name="LED42">FALSE</field>
|
||||
<field name="LED03">FALSE</field>
|
||||
<field name="LED13">FALSE</field>
|
||||
<field name="LED23">FALSE</field>
|
||||
<field name="LED33">FALSE</field>
|
||||
<field name="LED43">FALSE</field>
|
||||
<field name="LED04">FALSE</field>
|
||||
<field name="LED14">FALSE</field>
|
||||
<field name="LED24">FALSE</field>
|
||||
<field name="LED34">FALSE</field>
|
||||
<field name="LED44">FALSE</field>
|
||||
</block>
|
||||
</next>
|
||||
</block>
|
||||
</statement>
|
||||
</block>
|
||||
<block type="pxt-on-start"></block>
|
||||
</xml>
|
@ -1,16 +1 @@
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# . # . #
|
||||
# . . . #
|
||||
. # . # .
|
||||
. . # . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
})
|
||||
|
||||
|
@ -1,9 +1,24 @@
|
||||
{
|
||||
"bluetooth": "Support for additional Bluetooth services.",
|
||||
"bluetooth": "Support for additional Bluetooth services.\n\nSupport for additional Bluetooth services.",
|
||||
"bluetooth.advertiseUid": "Advertise an Eddystone UID",
|
||||
"bluetooth.advertiseUidBuffer": "Advertise an Eddystone UID",
|
||||
"bluetooth.advertiseUidBuffer|param|connectable": "true to keep bluetooth connectable for other services, false otherwise.",
|
||||
"bluetooth.advertiseUidBuffer|param|nsAndInstance": "16 bytes buffer of namespace (bytes 0-9) and instance (bytes 10-15)",
|
||||
"bluetooth.advertiseUidBuffer|param|power": "power level between 0 and 7, eg: 7",
|
||||
"bluetooth.advertiseUid|param|connectable": "true to keep bluetooth connectable for other services, false otherwise.",
|
||||
"bluetooth.advertiseUid|param|instance": "4 last bytes of the instance uid",
|
||||
"bluetooth.advertiseUid|param|ns": "4 last bytes of the namespace uid",
|
||||
"bluetooth.advertiseUid|param|power": "power level between 0 and 7, eg: 7",
|
||||
"bluetooth.advertiseUrl": "Advertise an Eddystone URL",
|
||||
"bluetooth.advertiseUrl|param|connectable": "true to keep bluetooth connectable for other services, false otherwise.",
|
||||
"bluetooth.advertiseUrl|param|power": "power level between 0 and 7, eg: 7",
|
||||
"bluetooth.advertiseUrl|param|url": "the url to transmit. Must be no longer than the supported eddystone url length, eg: \"https://pxt.io/\"",
|
||||
"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.setTransmitPower": "Sets the bluetooth transmit power between 0 (minimal) and 7 (maximum).",
|
||||
"bluetooth.setTransmitPower|param|power": "power level between 0 (minimal) and 7 (maximum), eg: 7.",
|
||||
"bluetooth.startAccelerometerService": "Starts the Bluetooth accelerometer service",
|
||||
"bluetooth.startButtonService": "Starts the Bluetooth button service",
|
||||
"bluetooth.startIOPinService": "Starts the Bluetooth IO pin service.",
|
||||
@ -11,6 +26,7 @@
|
||||
"bluetooth.startMagnetometerService": "Starts the Bluetooth magnetometer service",
|
||||
"bluetooth.startTemperatureService": "Starts the Bluetooth temperature service",
|
||||
"bluetooth.startUartService": "Starts the Bluetooth UART service",
|
||||
"bluetooth.stopAdvertising": "Stops advertising Eddystone end points",
|
||||
"bluetooth.uartReadUntil": "Reads from the Bluetooth UART service buffer, returning its contents when the specified delimiter character is encountered.",
|
||||
"bluetooth.uartWriteNumber": "Prints a numeric value to the serial",
|
||||
"bluetooth.uartWriteString": "Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.",
|
||||
|
@ -1,6 +1,9 @@
|
||||
{
|
||||
"bluetooth.advertiseUid|block": "bluetooth advertise UID|namespace (bytes 6-9)%ns|instance (bytes 2-6)%instance|with power %power|connectable %connectable",
|
||||
"bluetooth.advertiseUrl|block": "bluetooth advertise url %url|with power %power|connectable %connectable",
|
||||
"bluetooth.onBluetoothConnected|block": "on bluetooth connected",
|
||||
"bluetooth.onBluetoothDisconnected|block": "on bluetooth disconnected",
|
||||
"bluetooth.setTransmitPower|block": "bluetooth set transmit power %power",
|
||||
"bluetooth.startAccelerometerService|block": "bluetooth accelerometer service",
|
||||
"bluetooth.startButtonService|block": "bluetooth button service",
|
||||
"bluetooth.startIOPinService|block": "bluetooth io pin service",
|
||||
@ -8,6 +11,7 @@
|
||||
"bluetooth.startMagnetometerService|block": "bluetooth magnetometer service",
|
||||
"bluetooth.startTemperatureService|block": "bluetooth temperature service",
|
||||
"bluetooth.startUartService|block": "bluetooth uart service",
|
||||
"bluetooth.stopAdvertising|block": "bluetooth stop advertising",
|
||||
"bluetooth.uartReadUntil|block": "bluetooth uart|read until %del=serial_delimiter_conv",
|
||||
"bluetooth.uartWriteNumber|block": "bluetooth uart|write number %value",
|
||||
"bluetooth.uartWriteString|block": "bluetooth uart|write string %data",
|
||||
|
6
libs/bluetooth/_locales/de/bluetooth-jsdoc-strings.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"bluetooth.uartWriteNumber": "Gibt einen numerischen Wert an die serielle",
|
||||
"bluetooth.uartWriteValue": "Schreibt ein ``Namen: Wert`` Wertepaar auf die serielle Schnittstelle.",
|
||||
"bluetooth.uartWriteValue|param|name": "Name des Wertestreams, z.B.: x",
|
||||
"bluetooth.uartWriteValue|param|value": "Schreiben"
|
||||
}
|
@ -7,11 +7,10 @@ using namespace pxt;
|
||||
/**
|
||||
* Support for additional Bluetooth services.
|
||||
*/
|
||||
//% color=#0082FB weight=20
|
||||
//% color=#0082FB weight=96 icon="\uf294"
|
||||
namespace bluetooth {
|
||||
MicroBitUARTService *uart = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Starts the Bluetooth accelerometer service
|
||||
*/
|
||||
@ -119,5 +118,60 @@ namespace bluetooth {
|
||||
//% parts="bluetooth"
|
||||
void onBluetoothDisconnected(Action body) {
|
||||
registerWithDal(MICROBIT_ID_BLE, MICROBIT_BLE_EVT_DISCONNECTED, body);
|
||||
}
|
||||
}
|
||||
|
||||
const int8_t CALIBRATED_POWERS[] = {-49, -37, -33, -28, -25, -20, -15, -10};
|
||||
/**
|
||||
* Advertise an Eddystone URL
|
||||
* @param url the url to transmit. Must be no longer than the supported eddystone url length, eg: "https://pxt.io/"
|
||||
* @param power power level between 0 and 7, eg: 7
|
||||
* @param connectable true to keep bluetooth connectable for other services, false otherwise.
|
||||
*/
|
||||
//% blockId=eddystone_advertise_url block="bluetooth advertise url %url|with power %power|connectable %connectable"
|
||||
//% parts=bluetooth weight=11 blockGap=8
|
||||
//% help=bluetooth/advertise-url blockExternalInputs=1
|
||||
void advertiseUrl(StringData* url, int power, bool connectable) {
|
||||
power = min(MICROBIT_BLE_POWER_LEVELS-1, max(0, power));
|
||||
int8_t level = CALIBRATED_POWERS[power];
|
||||
uBit.bleManager.advertiseEddystoneUrl(ManagedString(url), level, connectable);
|
||||
uBit.bleManager.setTransmitPower(power);
|
||||
}
|
||||
|
||||
/**
|
||||
* Advertise an Eddystone UID
|
||||
* @param nsAndInstance 16 bytes buffer of namespace (bytes 0-9) and instance (bytes 10-15)
|
||||
* @param power power level between 0 and 7, eg: 7
|
||||
* @param connectable true to keep bluetooth connectable for other services, false otherwise.
|
||||
*/
|
||||
//% parts=bluetooth weight=12 advanced=true
|
||||
void advertiseUidBuffer(Buffer nsAndInstance, int power, bool connectable) {
|
||||
ManagedBuffer buf(nsAndInstance);
|
||||
if (buf.length() != 16) return;
|
||||
|
||||
power = min(MICROBIT_BLE_POWER_LEVELS-1, max(0, power));
|
||||
int8_t level = CALIBRATED_POWERS[power];
|
||||
uint8_t uidNs[10]; buf.readBytes(uidNs, 0, 10);
|
||||
uint8_t uidInst[6]; buf.readBytes(uidInst, 10, 6);
|
||||
uBit.bleManager.advertiseEddystoneUid((const char*)uidNs, (const char*)uidInst, level, connectable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the bluetooth transmit power between 0 (minimal) and 7 (maximum).
|
||||
* @param power power level between 0 (minimal) and 7 (maximum), eg: 7.
|
||||
*/
|
||||
//% parts=bluetooth weight=5 help=bluetooth/set-transmit-power advanced=true
|
||||
//% blockId=bluetooth_settransmitpower block="bluetooth set transmit power %power"
|
||||
void setTransmitPower(int power) {
|
||||
uBit.bleManager.setTransmitPower(min(MICROBIT_BLE_POWER_LEVELS-1, max(0, power)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops advertising Eddystone end points
|
||||
*/
|
||||
//% blockId=eddystone_stop_advertising block="bluetooth stop advertising"
|
||||
//% parts=bluetooth weight=10
|
||||
//% help=bluetooth/stop-advertising advanced=true
|
||||
void stopAdvertising() {
|
||||
uBit.bleManager.stopAdvertising();
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Support for additional Bluetooth services.
|
||||
*/
|
||||
//% color=#0082FB weight=20
|
||||
//% color=#0082FB weight=96 icon="\uf294"
|
||||
namespace bluetooth {
|
||||
/**
|
||||
* Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.
|
||||
@ -46,4 +46,21 @@ namespace bluetooth {
|
||||
// dummy implementation for simulator
|
||||
return "???"
|
||||
}
|
||||
|
||||
/**
|
||||
* Advertise an Eddystone UID
|
||||
* @param ns 4 last bytes of the namespace uid
|
||||
* @param instance 4 last bytes of the instance uid
|
||||
* @param power power level between 0 and 7, eg: 7
|
||||
* @param connectable true to keep bluetooth connectable for other services, false otherwise.
|
||||
*/
|
||||
//% blockId=eddystone_advertise_uid block="bluetooth advertise UID|namespace (bytes 6-9)%ns|instance (bytes 2-6)%instance|with power %power|connectable %connectable"
|
||||
//% parts=bluetooth weight=12 blockGap=8
|
||||
//% help=bluetooth/advertise-uid blockExternalInputs=1
|
||||
export function advertiseUid(ns: number, instance: number, power: number, connectable: boolean) {
|
||||
const buf = pins.createBuffer(16);
|
||||
buf.setNumber(NumberFormat.Int32BE, 6, ns);
|
||||
buf.setNumber(NumberFormat.Int32BE, 12, instance);
|
||||
bluetooth.advertiseUidBuffer(buf, power, connectable);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,8 @@
|
||||
"enums.d.ts",
|
||||
"shims.d.ts",
|
||||
"bluetooth.ts",
|
||||
"bluetooth.cpp"
|
||||
"bluetooth.cpp",
|
||||
"_locales/de/bluetooth-jsdoc-strings.json"
|
||||
],
|
||||
"public": true,
|
||||
"dependencies": {
|
||||
@ -16,20 +17,70 @@
|
||||
"config": {
|
||||
"microbit-dal": {
|
||||
"bluetooth": {
|
||||
"enabled": 1,
|
||||
"pairing_mode": 1,
|
||||
"enabled": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"optionalConfig": {
|
||||
"microbit-dal": {
|
||||
"bluetooth": {
|
||||
"private_addressing": 0,
|
||||
"open": 0,
|
||||
"whitelist": 1,
|
||||
"advertising_timeout": 0,
|
||||
"tx_power": 6,
|
||||
"dfu_service": 1,
|
||||
"event_service": 1,
|
||||
"device_info_service": 1
|
||||
"device_info_service": 1,
|
||||
"eddystone_url": 1,
|
||||
"eddystone_uid": 1,
|
||||
"open": 0,
|
||||
"pairing_mode": 1,
|
||||
"whitelist": 1,
|
||||
"security_level": "SECURITY_MODE_ENCRYPTION_NO_MITM"
|
||||
},
|
||||
"gatt_table_size": "0x700"
|
||||
}
|
||||
}
|
||||
},
|
||||
"userConfigs": [
|
||||
{
|
||||
"description": "Unsecure: Anyone can connect via Bluetooth.",
|
||||
"config": {
|
||||
"microbit-dal": {
|
||||
"bluetooth": {
|
||||
"open": 1,
|
||||
"pairing_mode": 0,
|
||||
"whitelist": 0,
|
||||
"security_level": null
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "JustWorks pairing (default): Button press to pair.",
|
||||
"config": {
|
||||
"microbit-dal": {
|
||||
"bluetooth": {
|
||||
"open": null,
|
||||
"pairing_mode": null,
|
||||
"whitelist": null,
|
||||
"security_level": null
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Passkey pairing: Button press and 6 digit key to pair.",
|
||||
"config": {
|
||||
"microbit-dal": {
|
||||
"bluetooth": {
|
||||
"open": 0,
|
||||
"pairing_mode": 1,
|
||||
"whitelist": 1,
|
||||
"security_level": "SECURITY_MODE_ENCRYPTION_WITH_MITM"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"installedVersion": "vzlhfd"
|
||||
}
|
38
libs/bluetooth/shims.d.ts
vendored
@ -4,7 +4,7 @@
|
||||
/**
|
||||
* Support for additional Bluetooth services.
|
||||
*/
|
||||
//% color=#0082FB weight=20
|
||||
//% color=#0082FB weight=96 icon="\uf294"
|
||||
declare namespace bluetooth {
|
||||
|
||||
/**
|
||||
@ -80,6 +80,42 @@ declare namespace bluetooth {
|
||||
//% blockId=bluetooth_on_disconnected block="on bluetooth disconnected"
|
||||
//% parts="bluetooth" shim=bluetooth::onBluetoothDisconnected
|
||||
function onBluetoothDisconnected(body: () => void): void;
|
||||
|
||||
/**
|
||||
* Advertise an Eddystone URL
|
||||
* @param url the url to transmit. Must be no longer than the supported eddystone url length, eg: "https://pxt.io/"
|
||||
* @param power power level between 0 and 7, eg: 7
|
||||
* @param connectable true to keep bluetooth connectable for other services, false otherwise.
|
||||
*/
|
||||
//% blockId=eddystone_advertise_url block="bluetooth advertise url %url|with power %power|connectable %connectable"
|
||||
//% parts=bluetooth weight=11 blockGap=8
|
||||
//% help=bluetooth/advertise-url blockExternalInputs=1 shim=bluetooth::advertiseUrl
|
||||
function advertiseUrl(url: string, power: number, connectable: boolean): void;
|
||||
|
||||
/**
|
||||
* Advertise an Eddystone UID
|
||||
* @param nsAndInstance 16 bytes buffer of namespace (bytes 0-9) and instance (bytes 10-15)
|
||||
* @param power power level between 0 and 7, eg: 7
|
||||
* @param connectable true to keep bluetooth connectable for other services, false otherwise.
|
||||
*/
|
||||
//% parts=bluetooth weight=12 advanced=true shim=bluetooth::advertiseUidBuffer
|
||||
function advertiseUidBuffer(nsAndInstance: Buffer, power: number, connectable: boolean): void;
|
||||
|
||||
/**
|
||||
* Sets the bluetooth transmit power between 0 (minimal) and 7 (maximum).
|
||||
* @param power power level between 0 (minimal) and 7 (maximum), eg: 7.
|
||||
*/
|
||||
//% parts=bluetooth weight=5 help=bluetooth/set-transmit-power advanced=true
|
||||
//% blockId=bluetooth_settransmitpower block="bluetooth set transmit power %power" shim=bluetooth::setTransmitPower
|
||||
function setTransmitPower(power: number): void;
|
||||
|
||||
/**
|
||||
* Stops advertising Eddystone end points
|
||||
*/
|
||||
//% blockId=eddystone_stop_advertising block="bluetooth stop advertising"
|
||||
//% parts=bluetooth weight=10
|
||||
//% help=bluetooth/stop-advertising advanced=true shim=bluetooth::stopAdvertising
|
||||
function stopAdvertising(): void;
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
||||
|
@ -1,62 +1,3 @@
|
||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||
<block type="device_forever">
|
||||
<statement name="HANDLER">
|
||||
<block type="device_show_leds">
|
||||
<field name="LED00">FALSE</field>
|
||||
<field name="LED10">FALSE</field>
|
||||
<field name="LED20">FALSE</field>
|
||||
<field name="LED30">FALSE</field>
|
||||
<field name="LED40">FALSE</field>
|
||||
<field name="LED01">FALSE</field>
|
||||
<field name="LED11">TRUE</field>
|
||||
<field name="LED21">FALSE</field>
|
||||
<field name="LED31">TRUE</field>
|
||||
<field name="LED41">FALSE</field>
|
||||
<field name="LED02">FALSE</field>
|
||||
<field name="LED12">FALSE</field>
|
||||
<field name="LED22">FALSE</field>
|
||||
<field name="LED32">FALSE</field>
|
||||
<field name="LED42">FALSE</field>
|
||||
<field name="LED03">TRUE</field>
|
||||
<field name="LED13">FALSE</field>
|
||||
<field name="LED23">FALSE</field>
|
||||
<field name="LED33">FALSE</field>
|
||||
<field name="LED43">TRUE</field>
|
||||
<field name="LED04">FALSE</field>
|
||||
<field name="LED14">TRUE</field>
|
||||
<field name="LED24">TRUE</field>
|
||||
<field name="LED34">TRUE</field>
|
||||
<field name="LED44">FALSE</field>
|
||||
<next>
|
||||
<block type="device_show_leds">
|
||||
<field name="LED00">FALSE</field>
|
||||
<field name="LED10">FALSE</field>
|
||||
<field name="LED20">FALSE</field>
|
||||
<field name="LED30">FALSE</field>
|
||||
<field name="LED40">FALSE</field>
|
||||
<field name="LED01">FALSE</field>
|
||||
<field name="LED11">FALSE</field>
|
||||
<field name="LED21">FALSE</field>
|
||||
<field name="LED31">FALSE</field>
|
||||
<field name="LED41">FALSE</field>
|
||||
<field name="LED02">FALSE</field>
|
||||
<field name="LED12">FALSE</field>
|
||||
<field name="LED22">FALSE</field>
|
||||
<field name="LED32">FALSE</field>
|
||||
<field name="LED42">FALSE</field>
|
||||
<field name="LED03">FALSE</field>
|
||||
<field name="LED13">FALSE</field>
|
||||
<field name="LED23">FALSE</field>
|
||||
<field name="LED33">FALSE</field>
|
||||
<field name="LED43">FALSE</field>
|
||||
<field name="LED04">FALSE</field>
|
||||
<field name="LED14">FALSE</field>
|
||||
<field name="LED24">FALSE</field>
|
||||
<field name="LED34">FALSE</field>
|
||||
<field name="LED44">FALSE</field>
|
||||
</block>
|
||||
</next>
|
||||
</block>
|
||||
</statement>
|
||||
</block>
|
||||
<block type="pxt-on-start"></block>
|
||||
</xml>
|
@ -1,16 +1 @@
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# . # . #
|
||||
# . . . #
|
||||
. # . # .
|
||||
. . # . .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
})
|
||||
|
||||
|
373
libs/core/ManagedBuffer.cpp
Normal file
@ -0,0 +1,373 @@
|
||||
#include "MicroBit.h"
|
||||
#include "ManagedBuffer.h"
|
||||
#include <limits.h>
|
||||
|
||||
static const char empty[] __attribute__ ((aligned (4))) = "\xff\xff\0\0\0";
|
||||
|
||||
/**
|
||||
* Internal constructor helper.
|
||||
* Configures this ManagedBuffer to refer to the static empty buffer.
|
||||
*/
|
||||
void ManagedBuffer::initEmpty()
|
||||
{
|
||||
ptr = (BufferData*)(void*)empty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
* Creates an empty ManagedBuffer.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p();
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer::ManagedBuffer()
|
||||
{
|
||||
initEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Creates an empty ManagedBuffer of the given size.
|
||||
*
|
||||
* @param length The length of the buffer to create.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p(16); // Creates a ManagedBuffer 16 bytes long.
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer::ManagedBuffer(int length)
|
||||
{
|
||||
this->init(NULL, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Creates a new ManagedBuffer of the given size,
|
||||
* and fills it with the data provided.
|
||||
*
|
||||
* @param data The data with which to fill the buffer.
|
||||
* @param length The length of the buffer to create.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* uint8_t buf = {13,5,2};
|
||||
* ManagedBuffer p(buf, 3); // Creates a ManagedBuffer 3 bytes long.
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer::ManagedBuffer(uint8_t *data, int length)
|
||||
{
|
||||
this->init(data, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy Constructor.
|
||||
* Add ourselves as a reference to an existing ManagedBuffer.
|
||||
*
|
||||
* @param buffer The ManagedBuffer to reference.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p();
|
||||
* ManagedBuffer p2(i); // Refers to the same buffer as p.
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer::ManagedBuffer(const ManagedBuffer &buffer)
|
||||
{
|
||||
ptr = buffer.ptr;
|
||||
ptr->incr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Create a buffer from a raw BufferData pointer. It will ptr->incr(). This is to be used by specialized runtimes.
|
||||
*
|
||||
* @param p The pointer to use.
|
||||
*/
|
||||
ManagedBuffer::ManagedBuffer(BufferData *p)
|
||||
{
|
||||
ptr = p;
|
||||
ptr->incr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal constructor-initialiser.
|
||||
*
|
||||
* @param data The data with which to fill the buffer.
|
||||
* @param length The length of the buffer to create.
|
||||
*
|
||||
*/
|
||||
void ManagedBuffer::init(uint8_t *data, int length)
|
||||
{
|
||||
if (length <= 0) {
|
||||
initEmpty();
|
||||
return;
|
||||
}
|
||||
|
||||
ptr = (BufferData *) malloc(sizeof(BufferData) + length);
|
||||
ptr->init();
|
||||
|
||||
ptr->length = length;
|
||||
|
||||
// Copy in the data buffer, if provided.
|
||||
if (data)
|
||||
memcpy(ptr->payload, data, length);
|
||||
else
|
||||
memset(ptr->payload, 0, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
* Removes buffer resources held by the instance.
|
||||
*/
|
||||
ManagedBuffer::~ManagedBuffer()
|
||||
{
|
||||
ptr->decr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy assign operation.
|
||||
*
|
||||
* Called when one ManagedBuffer is assigned the value of another using the '=' operator.
|
||||
* Decrements our reference count and free up the buffer as necessary.
|
||||
* Then, update our buffer to refer to that of the supplied ManagedBuffer,
|
||||
* and increase its reference count.
|
||||
*
|
||||
* @param p The ManagedBuffer to reference.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* uint8_t buf = {13,5,2};
|
||||
* ManagedBuffer p1(16);
|
||||
* ManagedBuffer p2(buf, 3);
|
||||
*
|
||||
* p1 = p2;
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer& ManagedBuffer::operator = (const ManagedBuffer &p)
|
||||
{
|
||||
if(ptr == p.ptr)
|
||||
return *this;
|
||||
|
||||
ptr->decr();
|
||||
ptr = p.ptr;
|
||||
ptr->incr();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Equality operation.
|
||||
*
|
||||
* Called when one ManagedBuffer is tested to be equal to another using the '==' operator.
|
||||
*
|
||||
* @param p The ManagedBuffer to test ourselves against.
|
||||
* @return true if this ManagedBuffer is identical to the one supplied, false otherwise.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
*
|
||||
* uint8_t buf = {13,5,2};
|
||||
* ManagedBuffer p1(16);
|
||||
* ManagedBuffer p2(buf, 3);
|
||||
*
|
||||
* if(p1 == p2) // will be true
|
||||
* uBit.display.scroll("same!");
|
||||
* @endcode
|
||||
*/
|
||||
bool ManagedBuffer::operator== (const ManagedBuffer& p)
|
||||
{
|
||||
if (ptr == p.ptr)
|
||||
return true;
|
||||
else
|
||||
return (ptr->length == p.ptr->length && (memcmp(ptr->payload, p.ptr->payload, ptr->length)==0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the byte at the given index to value provided.
|
||||
* @param position The index of the byte to change.
|
||||
* @param value The new value of the byte (0-255).
|
||||
* @return MICROBIT_OK, or MICROBIT_INVALID_PARAMETER.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p1(16);
|
||||
* p1.setByte(0,255); // Sets the firts byte in the buffer to the value 255.
|
||||
* @endcode
|
||||
*/
|
||||
int ManagedBuffer::setByte(int position, uint8_t value)
|
||||
{
|
||||
if (0 <= position && position < ptr->length)
|
||||
{
|
||||
ptr->payload[position] = value;
|
||||
return MICROBIT_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MICROBIT_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the value of the given byte in the buffer.
|
||||
*
|
||||
* @param position The index of the byte to read.
|
||||
* @return The value of the byte at the given position, or MICROBIT_INVALID_PARAMETER.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p1(16);
|
||||
* p1.setByte(0,255); // Sets the firts byte in the buffer to the value 255.
|
||||
* p1.getByte(0); // Returns 255.
|
||||
* @endcode
|
||||
*/
|
||||
int ManagedBuffer::getByte(int position)
|
||||
{
|
||||
if (0 <= position && position < ptr->length)
|
||||
return ptr->payload[position];
|
||||
else
|
||||
return MICROBIT_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current ptr, do not decr() it, and set the current instance to an empty buffer.
|
||||
* This is to be used by specialized runtimes which pass BufferData around.
|
||||
*/
|
||||
BufferData *ManagedBuffer::leakData()
|
||||
{
|
||||
BufferData* res = ptr;
|
||||
initEmpty();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int ManagedBuffer::fill(uint8_t value, int offset, int length)
|
||||
{
|
||||
if (offset < 0 || offset > ptr->length)
|
||||
return MICROBIT_INVALID_PARAMETER;
|
||||
if (length < 0)
|
||||
length = ptr->length;
|
||||
length = min(length, ptr->length - offset);
|
||||
|
||||
memset(ptr->payload + offset, value, length);
|
||||
|
||||
return MICROBIT_OK;
|
||||
}
|
||||
|
||||
ManagedBuffer ManagedBuffer::slice(int offset, int length) const
|
||||
{
|
||||
offset = min(ptr->length, offset);
|
||||
if (length < 0)
|
||||
length = ptr->length;
|
||||
length = min(length, ptr->length - offset);
|
||||
return ManagedBuffer(ptr->payload + offset, length);
|
||||
}
|
||||
|
||||
void ManagedBuffer::shift(int offset, int start, int len)
|
||||
{
|
||||
if (len < 0) len = ptr->length - start;
|
||||
if (start < 0 || start + len > ptr->length || start + len < start
|
||||
|| len == 0 || offset == 0 || offset == INT_MIN) return;
|
||||
if (offset <= -len || offset >= len) {
|
||||
fill(0);
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t *data = ptr->payload + start;
|
||||
if (offset < 0) {
|
||||
offset = -offset;
|
||||
memmove(data + offset, data, len - offset);
|
||||
memset(data, 0, offset);
|
||||
} else {
|
||||
len = len - offset;
|
||||
memmove(data, data + offset, len);
|
||||
memset(data + len, 0, offset);
|
||||
}
|
||||
}
|
||||
|
||||
void ManagedBuffer::rotate(int offset, int start, int len)
|
||||
{
|
||||
if (len < 0) len = ptr->length - start;
|
||||
if (start < 0 || start + len > ptr-> length || start + len < start
|
||||
|| len == 0 || offset == 0 || offset == INT_MIN) return;
|
||||
|
||||
if (offset < 0)
|
||||
offset += len << 8; // try to make it positive
|
||||
offset %= len;
|
||||
if (offset < 0)
|
||||
offset += len;
|
||||
|
||||
uint8_t *data = ptr->payload + start;
|
||||
|
||||
uint8_t *n_first = data + offset;
|
||||
uint8_t *first = data;
|
||||
uint8_t *next = n_first;
|
||||
uint8_t *last = data + len;
|
||||
|
||||
while (first != next) {
|
||||
uint8_t tmp = *first;
|
||||
*first++ = *next;
|
||||
*next++ = tmp;
|
||||
if (next == last) {
|
||||
next = n_first;
|
||||
} else if (first == n_first) {
|
||||
n_first = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ManagedBuffer::writeBuffer(int dstOffset, const ManagedBuffer &src, int srcOffset, int length)
|
||||
{
|
||||
if (length < 0)
|
||||
length = src.length();
|
||||
|
||||
if (srcOffset < 0 || dstOffset < 0 || dstOffset > ptr->length)
|
||||
return MICROBIT_INVALID_PARAMETER;
|
||||
|
||||
length = min(src.length() - srcOffset, ptr->length - dstOffset);
|
||||
|
||||
if (length < 0)
|
||||
return MICROBIT_INVALID_PARAMETER;
|
||||
|
||||
if (ptr == src.ptr) {
|
||||
memmove(getBytes() + dstOffset, src.ptr->payload + srcOffset, length);
|
||||
} else {
|
||||
memcpy(getBytes() + dstOffset, src.ptr->payload + srcOffset, length);
|
||||
}
|
||||
|
||||
return MICROBIT_OK;
|
||||
}
|
||||
|
||||
int ManagedBuffer::writeBytes(int offset, uint8_t *src, int length, bool swapBytes)
|
||||
{
|
||||
if (offset < 0 || length < 0 || offset + length > ptr->length)
|
||||
return MICROBIT_INVALID_PARAMETER;
|
||||
|
||||
if (swapBytes) {
|
||||
uint8_t *p = ptr->payload + offset + length;
|
||||
for (int i = 0; i < length; ++i)
|
||||
*--p = src[i];
|
||||
} else {
|
||||
memcpy(ptr->payload + offset, src, length);
|
||||
}
|
||||
|
||||
return MICROBIT_OK;
|
||||
}
|
||||
|
||||
int ManagedBuffer::readBytes(uint8_t *dst, int offset, int length, bool swapBytes) const
|
||||
{
|
||||
if (offset < 0 || length < 0 || offset + length > ptr->length)
|
||||
return MICROBIT_INVALID_PARAMETER;
|
||||
|
||||
if (swapBytes) {
|
||||
uint8_t *p = ptr->payload + offset + length;
|
||||
for (int i = 0; i < length; ++i)
|
||||
dst[i] = *--p;
|
||||
} else {
|
||||
memcpy(dst, ptr->payload + offset, length);
|
||||
}
|
||||
|
||||
return MICROBIT_OK;
|
||||
}
|
257
libs/core/ManagedBuffer.h
Normal file
@ -0,0 +1,257 @@
|
||||
#ifndef MICROBIT_MANAGED_BUFFER_H
|
||||
#define MICROBIT_MANAGED_BUFFER_H
|
||||
|
||||
#include "mbed.h"
|
||||
#include "RefCounted.h"
|
||||
|
||||
struct BufferData : RefCounted
|
||||
{
|
||||
uint16_t length; // The length of the payload in bytes
|
||||
uint8_t payload[0]; // ManagedBuffer data
|
||||
};
|
||||
|
||||
/**
|
||||
* Class definition for a ManagedBuffer.
|
||||
* A ManagedBuffer holds a series of bytes, used with MicroBitRadio channels and in other places.
|
||||
* n.b. This is a mutable, managed type.
|
||||
*/
|
||||
class ManagedBuffer
|
||||
{
|
||||
BufferData *ptr; // Pointer to payload data
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
* Creates an empty ManagedBuffer. The 'ptr' field in all empty buffers is shared.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p();
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Creates a new ManagedBuffer of the given size.
|
||||
*
|
||||
* @param length The length of the buffer to create.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p(16); // Creates a ManagedBuffer 16 bytes long.
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer(int length);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Creates an empty ManagedBuffer of the given size,
|
||||
* and fills it with the data provided.
|
||||
*
|
||||
* @param data The data with which to fill the buffer.
|
||||
* @param length The length of the buffer to create.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* uint8_t buf[] = {13,5,2};
|
||||
* ManagedBuffer p(buf, 3); // Creates a ManagedBuffer 3 bytes long.
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer(uint8_t *data, int length);
|
||||
|
||||
/**
|
||||
* Copy Constructor.
|
||||
* Add ourselves as a reference to an existing ManagedBuffer.
|
||||
*
|
||||
* @param buffer The ManagedBuffer to reference.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p();
|
||||
* ManagedBuffer p2(i); // Refers to the same buffer as p.
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer(const ManagedBuffer &buffer);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Create a buffer from a raw BufferData pointer. It will ptr->incr(). This is to be used by specialized runtimes.
|
||||
*
|
||||
* @param p The pointer to use.
|
||||
*/
|
||||
ManagedBuffer(BufferData *p);
|
||||
|
||||
/**
|
||||
* Internal constructor helper.
|
||||
* Configures this ManagedBuffer to refer to the static empty buffer.
|
||||
*/
|
||||
void initEmpty();
|
||||
|
||||
/**
|
||||
* Internal constructor-initialiser.
|
||||
*
|
||||
* @param data The data with which to fill the buffer.
|
||||
* @param length The length of the buffer to create.
|
||||
*
|
||||
*/
|
||||
void init(uint8_t *data, int length);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
* Removes buffer resources held by the instance.
|
||||
*/
|
||||
~ManagedBuffer();
|
||||
|
||||
/**
|
||||
* Provide an array containing the buffer data.
|
||||
* @return The contents of this buffer, as an array of bytes.
|
||||
*/
|
||||
uint8_t *getBytes()
|
||||
{
|
||||
return ptr->payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current ptr, do not decr() it, and set the current instance to an empty buffer.
|
||||
* This is to be used by specialized runtimes which pass BufferData around.
|
||||
*/
|
||||
BufferData *leakData();
|
||||
|
||||
/**
|
||||
* Copy assign operation.
|
||||
*
|
||||
* Called when one ManagedBuffer is assigned the value of another using the '=' operator.
|
||||
* Decrements our reference count and free up the buffer as necessary.
|
||||
* Then, update our buffer to refer to that of the supplied ManagedBuffer,
|
||||
* and increase its reference count.
|
||||
*
|
||||
* @param p The ManagedBuffer to reference.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* uint8_t buf = {13,5,2};
|
||||
* ManagedBuffer p1(16);
|
||||
* ManagedBuffer p2(buf, 3);
|
||||
*
|
||||
* p1 = p2;
|
||||
* @endcode
|
||||
*/
|
||||
ManagedBuffer& operator = (const ManagedBuffer& p);
|
||||
|
||||
/**
|
||||
* Array access operation (read).
|
||||
*
|
||||
* Called when a ManagedBuffer is dereferenced with a [] operation.
|
||||
* Transparently map this through to the underlying payload for elegance of programming.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p1(16);
|
||||
* uint8_t data = p1[0];
|
||||
* @endcode
|
||||
*/
|
||||
uint8_t operator [] (int i) const
|
||||
{
|
||||
return ptr->payload[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Array access operation (modify).
|
||||
*
|
||||
* Called when a ManagedBuffer is dereferenced with a [] operation.
|
||||
* Transparently map this through to the underlying payload for elegance of programming.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p1(16);
|
||||
* p1[0] = 42;
|
||||
* @endcode
|
||||
*/
|
||||
uint8_t& operator [] (int i)
|
||||
{
|
||||
return ptr->payload[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Equality operation.
|
||||
*
|
||||
* Called when one ManagedBuffer is tested to be equal to another using the '==' operator.
|
||||
*
|
||||
* @param p The ManagedBuffer to test ourselves against.
|
||||
* @return true if this ManagedBuffer is identical to the one supplied, false otherwise.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
*
|
||||
* uint8_t buf = {13,5,2};
|
||||
* ManagedBuffer p1(16);
|
||||
* ManagedBuffer p2(buf, 3);
|
||||
*
|
||||
* if(p1 == p2) // will be true
|
||||
* uBit.display.scroll("same!");
|
||||
* @endcode
|
||||
*/
|
||||
bool operator== (const ManagedBuffer& p);
|
||||
|
||||
/**
|
||||
* Sets the byte at the given index to value provided.
|
||||
* @param position The index of the byte to change.
|
||||
* @param value The new value of the byte (0-255).
|
||||
* @return MICROBIT_OK, or MICROBIT_INVALID_PARAMETER.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p1(16);
|
||||
* p1.setByte(0,255); // Sets the first byte in the buffer to the value 255.
|
||||
* @endcode
|
||||
*/
|
||||
int setByte(int position, uint8_t value);
|
||||
|
||||
/**
|
||||
* Determines the value of the given byte in the buffer.
|
||||
*
|
||||
* @param position The index of the byte to read.
|
||||
* @return The value of the byte at the given position, or MICROBIT_INVALID_PARAMETER.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p1(16);
|
||||
* p1.setByte(0,255); // Sets the first byte in the buffer to the value 255.
|
||||
* p1.getByte(0); // Returns 255.
|
||||
* @endcode
|
||||
*/
|
||||
int getByte(int position);
|
||||
|
||||
/**
|
||||
* Gets number of bytes in this buffer
|
||||
* @return The size of the buffer in bytes.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* ManagedBuffer p1(16);
|
||||
* p1.length(); // Returns 16.
|
||||
* @endcode
|
||||
*/
|
||||
int length() const { return ptr->length; }
|
||||
|
||||
int fill(uint8_t value, int offset = 0, int length = -1);
|
||||
|
||||
ManagedBuffer slice(int offset = 0, int length = -1) const;
|
||||
|
||||
void shift(int offset, int start = 0, int length = -1);
|
||||
|
||||
void rotate(int offset, int start = 0, int length = -1);
|
||||
|
||||
int readBytes(uint8_t *dst, int offset, int length, bool swapBytes = false) const;
|
||||
|
||||
int writeBytes(int dstOffset, uint8_t *src, int length, bool swapBytes = false);
|
||||
|
||||
int writeBuffer(int dstOffset, const ManagedBuffer &src, int srcOffset = 0, int length = -1);
|
||||
|
||||
bool isReadOnly() const { return ptr->isReadOnly(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -85,7 +85,7 @@
|
||||
"game.setLife": "Sets the current life value",
|
||||
"game.setLife|param|value": "TODO",
|
||||
"game.setScore": "Sets the current score value",
|
||||
"game.setScore|param|value": "TODO",
|
||||
"game.setScore|param|value": "new score value.",
|
||||
"game.showScore": "Displays the score on the screen.",
|
||||
"game.startCountdown": "Starts a game countdown timer",
|
||||
"game.startCountdown|param|ms": "countdown duration in milliseconds, eg: 10000",
|
||||
@ -97,26 +97,28 @@
|
||||
"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.buttonIsPressed|param|button": "the button to query the request, eg: Button.A",
|
||||
"input.calibrate": "Obsolete, compass calibration is automatic.",
|
||||
"input.compassHeading": "Get the current 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.onButtonPressed|param|body": "code to run when event is raised",
|
||||
"input.onButtonPressed|param|button": "the button that needs to be pressed",
|
||||
"input.onGesture": "Do something when when a gesture is done (like shaking the micro:bit).",
|
||||
"input.onGesture|param|body": "TODO",
|
||||
"input.onGesture|param|body": "code to run when gesture is raised",
|
||||
"input.onGesture|param|gesture": "the type of gesture to track, eg: Gesture.Shake",
|
||||
"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 is pressed.",
|
||||
"input.onPinPressed|param|body": "the code to run when the pin is pressed",
|
||||
"input.onPinPressed|param|name": "the pin that needs to be pressed",
|
||||
"input.onPinPressed|param|name": "the pin that needs to be pressed, eg: TouchPin.P0",
|
||||
"input.onPinReleased": "Do something when a pin is released.",
|
||||
"input.onPinReleased|param|body": "the code to run when the pin is released",
|
||||
"input.onPinReleased|param|name": "the pin that needs to be released",
|
||||
"input.onPinReleased|param|name": "the pin that needs to be released, eg: TouchPin.P0",
|
||||
"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.",
|
||||
@ -124,7 +126,7 @@
|
||||
"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.pinIsPressed|param|name": "pin used to detect the touch, eg: TouchPin.P0",
|
||||
"input.rotation": "The pitch or roll of the device, rotation along the ``x-axis`` or ``y-axis``, in degrees.",
|
||||
"input.rotation|param|kind": "TODO",
|
||||
"input.runningTime": "Gets the number of milliseconds elapsed since power on.",
|
||||
@ -166,7 +168,7 @@
|
||||
"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.noteFrequency|param|name": "the note name, eg: Note.C",
|
||||
"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)",
|
||||
@ -179,24 +181,24 @@
|
||||
"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.analogPitch|param|frequency": "frequency to modulate in Hz.",
|
||||
"pins.analogPitch|param|ms": "duration of the pitch in milli seconds.",
|
||||
"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.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P0",
|
||||
"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.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P0",
|
||||
"pins.analogSetPitchPin": "Sets the pin used when using `analog pitch` or music.",
|
||||
"pins.analogSetPitchPin|param|name": "pin to modulate pitch from",
|
||||
"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|name": "pin name to write to, eg: AnalogPin.P0",
|
||||
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0",
|
||||
"pins.createBuffer": "Create a new zero-initialized buffer.",
|
||||
"pins.createBuffer|param|size": "number of bytes in the buffer",
|
||||
"pins.digitalReadPin": "Read the specified pin or connector as either 0 or 1",
|
||||
"pins.digitalReadPin|param|name": "pin to read from",
|
||||
"pins.digitalReadPin|param|name": "pin to read from, eg: DigitalPin.P0",
|
||||
"pins.digitalWritePin": "Set a pin or connector value to either 0 or 1.",
|
||||
"pins.digitalWritePin|param|name": "pin to write to",
|
||||
"pins.digitalWritePin|param|name": "pin to write to, eg: DigitalPin.P0",
|
||||
"pins.digitalWritePin|param|value": "value to set on the pin, 1 eg,0",
|
||||
"pins.i2cReadBuffer": "Read `size` bytes from a 7-bit I2C `address`.",
|
||||
"pins.i2cReadNumber": "Read one number from 7-bit I2C address.",
|
||||
@ -209,19 +211,21 @@
|
||||
"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|param|name": "digital pin to register to, eg: DigitalPin.P0",
|
||||
"pins.onPulsed|param|pulse": "the value of the pulse, eg: PulseValue.High",
|
||||
"pins.pulseDuration": "Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.",
|
||||
"pins.pulseIn": "Returns the duration of a pulse in microseconds",
|
||||
"pins.pulseIn|param|name": "the pin which measures the pulse",
|
||||
"pins.pulseIn|param|value": "the value of the pulse (default high)",
|
||||
"pins.pulseIn|param|name": "the pin which measures the pulse, eg: DigitalPin.P0",
|
||||
"pins.pulseIn|param|value": "the value of the pulse, eg: PulseValue.High",
|
||||
"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|name": "pin to write to, eg: AnalogPin.P0",
|
||||
"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 ",
|
||||
"pins.setPull|param|name": "pin to set the pull mode on, eg: DigitalPin.P0",
|
||||
"pins.setPull|param|pull": "one of the mbed pull configurations, eg: PinPullMode.PullUp",
|
||||
"pins.sizeOf": "Get the size in bytes of specified number format.",
|
||||
"pins.spiWrite": "Write to the SPI slave and return the response",
|
||||
"pins.spiWrite|param|value": "Data to be sent to the SPI slave",
|
||||
@ -232,8 +236,9 @@
|
||||
"serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.",
|
||||
"serial.readUntil|param|delimiter": "text delimiter that separates each text chunk",
|
||||
"serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.",
|
||||
"serial.redirect|param|rx": "the new reception pin",
|
||||
"serial.redirect|param|tx": "the new transmission pins",
|
||||
"serial.redirect|param|rate": "the new baud rate. eg: 115200",
|
||||
"serial.redirect|param|rx": "the new reception pin, eg: SerialPin.P1",
|
||||
"serial.redirect|param|tx": "the new transmission pins, eg: SerialPin.P0",
|
||||
"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.",
|
||||
|
@ -1,6 +1,86 @@
|
||||
{
|
||||
"AcceleratorRange.EightG": "The accelerator measures forces up to 8 gravity",
|
||||
"AcceleratorRange.EightG|block": "8g",
|
||||
"AcceleratorRange.FourG": "The accelerator measures forces up to 4 gravity",
|
||||
"AcceleratorRange.FourG|block": "4g",
|
||||
"AcceleratorRange.OneG": "The accelerator measures forces up to 1 gravity",
|
||||
"AcceleratorRange.OneG|block": "1g",
|
||||
"AcceleratorRange.TwoG": "The accelerator measures forces up to 2 gravity",
|
||||
"AcceleratorRange.TwoG|block": "2g",
|
||||
"BaudRate.BaudRate115200|block": "115200",
|
||||
"BaudRate.BaudRate9600|block": "9600",
|
||||
"BeatFraction.Breve|block": "4",
|
||||
"BeatFraction.Double|block": "2",
|
||||
"BeatFraction.Eighth|block": "1/8",
|
||||
"BeatFraction.Half|block": "1/2",
|
||||
"BeatFraction.Quarter|block": "1/4",
|
||||
"BeatFraction.Sixteenth|block": "1/16",
|
||||
"BeatFraction.Whole|block": "1",
|
||||
"Button.AB|block": "A+B",
|
||||
"Delimiters.Colon|block": ":",
|
||||
"Delimiters.Comma|block": ",",
|
||||
"Delimiters.Dollar|block": "$",
|
||||
"Delimiters.Fullstop|block": ".",
|
||||
"Delimiters.Hash|block": "#",
|
||||
"Delimiters.NewLine|block": "new line",
|
||||
"Dimension.Strength|block": "strength",
|
||||
"Dimension.X|block": "x",
|
||||
"Dimension.Y|block": "y",
|
||||
"Dimension.Z|block": "z",
|
||||
"Direction.Left|block": "left",
|
||||
"Direction.Right|block": "right",
|
||||
"DisplayMode.BackAndWhite|block": "black and white",
|
||||
"DisplayMode.Greyscale|block": "greyscale",
|
||||
"EventCreationMode.CreateAndFire": "MicroBitEvent is initialised, and its event handlers are immediately fired (not suitable for use in interrupts!).",
|
||||
"EventCreationMode.CreateOnly": "MicroBitEvent is initialised, and no further processing takes place.",
|
||||
"Gesture.EightG": "Raised when a 8G shock is detected",
|
||||
"Gesture.EightG|block": "8g",
|
||||
"Gesture.FreeFall": "Raised when the board is falling!",
|
||||
"Gesture.FreeFall|block": "free fall",
|
||||
"Gesture.LogoDown": "Raised when the logo is downward and the screen is vertical",
|
||||
"Gesture.LogoDown|block": "logo down",
|
||||
"Gesture.LogoUp": "Raised when the logo is upward and the screen is vertical",
|
||||
"Gesture.LogoUp|block": "logo up",
|
||||
"Gesture.ScreenDown": "Raised when the screen is pointing up and the board is horizontal",
|
||||
"Gesture.ScreenDown|block": "screen down",
|
||||
"Gesture.ScreenUp": "Raised when the screen is pointing down and the board is horizontal",
|
||||
"Gesture.ScreenUp|block": "screen up",
|
||||
"Gesture.Shake": "Raised when shaken",
|
||||
"Gesture.Shake|block": "shake",
|
||||
"Gesture.SixG": "Raised when a 6G shock is detected",
|
||||
"Gesture.SixG|block": "6g",
|
||||
"Gesture.ThreeG": "Raised when a 3G shock is detected",
|
||||
"Gesture.ThreeG|block": "3g",
|
||||
"Gesture.TiltLeft": "Raised when the screen is pointing left",
|
||||
"Gesture.TiltLeft|block": "tilt left",
|
||||
"Gesture.TiltRight": "Raised when the screen is pointing right",
|
||||
"Gesture.TiltRight|block": "tilt right",
|
||||
"LedSpriteProperty.Blink|block": "blink",
|
||||
"LedSpriteProperty.Brightness|block": "brightness",
|
||||
"LedSpriteProperty.Direction|block": "direction",
|
||||
"LedSpriteProperty.X|block": "x",
|
||||
"LedSpriteProperty.Y|block": "y",
|
||||
"Math.randomBoolean|block": "pick random true or false",
|
||||
"Math|block": "Math",
|
||||
"Note.CSharp3|block": "C#3",
|
||||
"Note.CSharp4|block": "C#4",
|
||||
"Note.CSharp5|block": "C#5",
|
||||
"Note.CSharp|block": "C#",
|
||||
"Note.FSharp3|block": "F#3",
|
||||
"Note.FSharp4|block": "F#4",
|
||||
"Note.FSharp5|block": "F#5",
|
||||
"Note.FSharp|block": "F#",
|
||||
"Note.GSharp3|block": "G#3",
|
||||
"Note.GSharp4|block": "G#4",
|
||||
"Note.GSharp5|block": "G#5",
|
||||
"Note.GSharp|block": "G#",
|
||||
"PinPullMode.PullDown|block": "down",
|
||||
"PinPullMode.PullNone|block": "none",
|
||||
"PinPullMode.PullUp|block": "up",
|
||||
"PulseValue.High|block": "high",
|
||||
"PulseValue.Low|block": "low",
|
||||
"Rotation.Pitch|block": "pitch",
|
||||
"Rotation.Roll|block": "roll",
|
||||
"String.charAt|block": "char from %this|at %pos",
|
||||
"String.compare|block": "compare %this| to %that",
|
||||
"String.concat|block": "join %this|%other",
|
||||
@ -32,6 +112,7 @@
|
||||
"game.createSprite|block": "create sprite at|x: %x|y: %y",
|
||||
"game.gameOver|block": "game over",
|
||||
"game.score|block": "score",
|
||||
"game.setScore|block": "set score %points",
|
||||
"game.startCountdown|block": "start countdown|(ms) %duration",
|
||||
"game|block": "game",
|
||||
"images.createBigImage|block": "create big image",
|
||||
@ -44,7 +125,7 @@
|
||||
"input.magneticForce|block": "magnetic force (µT)|%NAME",
|
||||
"input.onButtonPressed|block": "on button|%NAME|pressed",
|
||||
"input.onGesture|block": "on |%NAME",
|
||||
"input.onPinPressed|block": "on pin %NAME|pressed",
|
||||
"input.onPinPressed|block": "on pin %name|pressed",
|
||||
"input.onPinReleased|block": "on pin %NAME|released",
|
||||
"input.pinIsPressed|block": "pin %NAME|is pressed",
|
||||
"input.rotation|block": "rotation (°)|%NAME",
|
||||
@ -53,6 +134,7 @@
|
||||
"input.temperature|block": "temperature (°C)",
|
||||
"input|block": "input",
|
||||
"led.brightness|block": "brightness",
|
||||
"led.enable|block": "led enable %on",
|
||||
"led.plotBarGraph|block": "plot bar graph of %value |up to %high",
|
||||
"led.plot|block": "plot|x %x|y %y",
|
||||
"led.point|block": "point|x %x|y %y",
|
||||
@ -70,8 +152,10 @@
|
||||
"music.setTempo|block": "set tempo to (bpm)|%value",
|
||||
"music.tempo|block": "tempo (bpm)",
|
||||
"music|block": "music",
|
||||
"pins.analogPitch|block": "analog pitch %frequency|for (ms) %ms",
|
||||
"pins.analogReadPin|block": "analog read|pin %name",
|
||||
"pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros",
|
||||
"pins.analogSetPitchPin|block": "analog set pitch pin %name",
|
||||
"pins.analogWritePin|block": "analog write|pin %name|to %value",
|
||||
"pins.digitalReadPin|block": "digital read|pin %name",
|
||||
"pins.digitalWritePin|block": "digital write|pin %name|to %value",
|
||||
|
@ -1,6 +1,31 @@
|
||||
{
|
||||
"Math.abs": "Gibt den absoluten Wert einer Zahl aus (den Wert unabhängig davon, ob er positiv oder negativ ist).\nDer absolute Wert von -5 ist zum Beispiel der gleiche wie der von 5.",
|
||||
"Math.abs|param|x": "Ein numerischer Ausdruck, für den der absolute Wert benötigt wird.",
|
||||
"Math.max": "Gibt den größeren von zwei vorhandenen numerischen Ausdrücken aus.",
|
||||
"Math.min": "Gibt den niedrigeren von zwei vorhandenen numerischen Ausdrücken aus.",
|
||||
"Math.pow": "Gibt den Wert eines grundlegenden Ausdrucks bis zu einer bestimmten Stärke aus.",
|
||||
"Math.pow|param|x": "Der Basiswert des Ausdrucks.",
|
||||
"Math.pow|param|y": "Der exponentielle Wert des Ausdrucks.",
|
||||
"Math.random": "Gibt eine pseudozufüllige Zahl zwischen 0 und `max`aus.",
|
||||
"Math.randomBoolean": "Erzeugt zufällig einen \"wahr\" oder \"falsch\"-Wert, wie bei einem Münzwurf.",
|
||||
"Math.sign": "Gibt das Vorzeichen von x aus und zeigt an, ob dieses positiv, negativ oder null ist.",
|
||||
"Math.sign|param|x": "Der numerische Ausdruck, der getestet werden soll",
|
||||
"Math.sqrt": "Gibt die Quadratwurzel einer Zahl aus.",
|
||||
"Math.sqrt|param|x": "Ein numerischer Ausdruck.",
|
||||
"String.charAt": "Gibt den Buchstaben beim angegebenen Index aus.",
|
||||
"String.charAt|param|index": "Der null-basierte index des gewünschten Zeichens.",
|
||||
"String.charCodeAt": "Gibt den Unicode-Wert des Zeichens am vorgegebenen Ort aus.",
|
||||
"String.charCodeAt|param|index": "Der null-basierte Index des gewünschten Zeichens. Wenn kein Zeichen am angegeben Index vorhanden ist, wird NaN ausgegeben.",
|
||||
"String.compare": "Bestimmt die relative Reihenfolge zweier Strings (in ASCII).",
|
||||
"String.compare|param|that": "Zeichenfolge, die mit der Zielzeichenfolge verglichen werden soll",
|
||||
"String.concat": "Gibt eine Zeichenfolge aus, die die Verkettung von zwei oder mehr Zeichenfolgen ist.",
|
||||
"String.concat|param|other": "Die Zeichenfolge, die an das Ende einer Zeichenfolge angehängt werden soll.",
|
||||
"String.fromCharCode": "Erstelle Sie eine Zeichenfolge aus dem angegebenen ASCII-Zeichencode.",
|
||||
"String.isEmpty": "Gibt einen Wert aus, der anzeigt, ob die Zeichenfolge leer ist",
|
||||
"String.length": "Gibt die Länge einer Zeichenfolge aus.",
|
||||
"String.substr": "Gibt eine Teilzeichenfolge der aktuellen Zeichenfolge aus.",
|
||||
"String.substr|param|length": "Anzahl der zu extrahierenden Zeichen",
|
||||
"String.substr|param|start": "Erster Zeichenindex, kann beim zählen vom Ende negativ sein, zum Beispiel: 0",
|
||||
"basic": "Bietet Zugriff auf grundlegende mini-Funktionalität.",
|
||||
"basic.clearScreen": "Schalte alle LEDs aus",
|
||||
"basic.forever": "Wiederholt immer wieder den Code im Hintergrund. Bei jeder Iteration ist es möglich, anderen Code auszuführen.",
|
||||
@ -20,76 +45,84 @@
|
||||
"basic.showString|param|interval": "Wie schnell die Zeichen geändert werden; z.B. 150, 100, 200,-100",
|
||||
"basic.showString|param|text": "Text auf dem Bildschirm dargestellt werden soll, z.B.: \"Hallo!\"",
|
||||
"control": "Laufzeit- und Event-Dienstprogramme.",
|
||||
"control.assert": "Wenn die Bedingung falsch ist, zeige eine Nachricht auf der seriellen Konsole und gebe Panic-Code 098 aus",
|
||||
"control.deviceName": "Erzeugt einen Namen für das Gerät, basierend auf der Seriennummer",
|
||||
"control.eventSourceId": "Gibt den Wert einer C++-Laufzeitkonstanten aus",
|
||||
"control.eventTimestamp": "Holt den Zeitstempel des letzten Events auf dem Bus",
|
||||
"control.eventValue": "Holt den Wert des letzten ausgeführten Events auf dem Bus",
|
||||
"control.eventValueId": "Gibt den Wert einer C++-Laufzeitkonstanten aus",
|
||||
"control.inBackground": "Plant Code, der im Hintergrund wiedergegeben wird.",
|
||||
"control.onEvent": "Startet ein Event auf dem Event-Bus.",
|
||||
"control.panic": "Zeigt einen spezifizierten Fehlercode und hält das Programm an.",
|
||||
"control.raiseEvent": "Startet ein Event auf dem Event-Bus.",
|
||||
"control.raiseEvent|param|mode": "optionale Definition davon, wie ein Event nach dem Erstellen ausgeführt wird (Standard ist \"CREATE_AND_FIRE).",
|
||||
"control.raiseEvent|param|src": "ID der Calliope mini-Komponente, die das Event generiert hat, zum Beispiel CALLIOPE_ID_BUTTON_A.",
|
||||
"control.raiseEvent|param|value": "Komponentenspezifischer Code, der den Grund des Events angibt.",
|
||||
"control.reset": "Seit den mini zurück.",
|
||||
"control.runtimeWarning": "Zeige Warnmeldung im Simulator.",
|
||||
"control.waitMicros": "Sperrt die aktuelle Leitung für die Dauer der angegebenen Mikrosekunden",
|
||||
"control.waitMicros|param|micros": "Anzahl der Mikrosekunden, die gewartet werden soll, z.B.: 4",
|
||||
"game": "Eine Einzel-LED-Sprite-Spielumgebung",
|
||||
"game.addLife": "Fügt Leben zum aktuellen Spielstand hinzu",
|
||||
"game.addScore": "Fügt zum aktuellen Spielstand Punkte hinzu",
|
||||
"game.addScore|param|points": "Anzahl von zu verändernden Punkten, z.B.: 1",
|
||||
"game.createSprite": "Erzeugt einen neuen LED-Sprite, der nach rechts zeigt.",
|
||||
"game.createSprite|param|x": "horizontale Koordinate des Sprites, z.B. 2",
|
||||
"game.createSprite|param|y": "vertikale Koordinate des Sprites, z.B. 2",
|
||||
"game.currentTime": "Ruft die verbliebene Zeit (seit `starte Countdown`) oder die aktuelle Zeit (seit das Gerät gestartet wurde oder eine Stoppuhr aktiviert wurde) an.",
|
||||
"game.gameOver": "Gibt über eine Animation ein Spiel wieder.",
|
||||
"game.invalidSprite": "Ruft einen invaliden Sprite ab; wird genutzt, um Locale zu initialisieren.",
|
||||
"game.isGameOver": "Zeigt an, ob das Spil die \"Game Over\"-Sequenz angezeigt hat.",
|
||||
"game.isRunning": "Holt einen Wert, der anzeigt, ob das Spiel noch läuft. Gibt `falsch`aus, wenn das Spiel zu Ende ist.",
|
||||
"game.level": "Ruft das aktuelle Level ab",
|
||||
"game.levelUp": "Erhöht das Level und zeigt eine Nachricht an.",
|
||||
"game.life": "Ruft das aktuelle Leben ab",
|
||||
"game.removeLife": "Entfernt ein Leben",
|
||||
"game.score": "Ruft den aktuellen Punktestand ab",
|
||||
"game.setLife": "Setzt den aktuellen Wert der Leben",
|
||||
"game.setScore": "Setzt den aktuellen Wert des Spielstands",
|
||||
"game.setScore|param|value": "TODO",
|
||||
"game.showScore": "Zeigt den Spielstand auf dem Display.",
|
||||
"game.startCountdown": "Startet einen Spiel-Countdown",
|
||||
"game.startCountdown|param|ms": "Countdown-Dauer in Millisekunden, z.B.: 10000",
|
||||
"game.startStopwatch": "Startet eine Stoppuhr.`aktuelle Zeit`gibt die vergangene Zeit an.",
|
||||
"images": "Erstellung, Bearbeitung und Anzeige von LED-Bildern.",
|
||||
"images.createBigImage": "Erstellt ein Bild mit zwei Einzelbildern.",
|
||||
"images.createImage": "Erstellt ein Bild, das auf den LED-Bildschirm passt.",
|
||||
"input": "Ereignisse und Daten der Sensoren",
|
||||
"input.acceleration": "Holt den Beschleunigungswert in Milli-Erdanziehung (wenn das Board flach mit dem Display nach oben liegt, X = 0, y = 0 und Z =-1024)",
|
||||
"input.acceleration|param|dimension": "TODO",
|
||||
"input.buttonIsPressed": "Erhalte den Sie den Tastenstatus (gepresst oder nicht) für ``A`` und ``B``.",
|
||||
"input.calibrate": "Veraltet, Kompasskalibrierung erfolgt automatisch.",
|
||||
"input.compassHeading": "Holt die aktuelle Kompassrichtung in Grad.",
|
||||
"input.lightLevel": "Liest die Lichtintensität auf dem LED-Bildschirm im Bereich von ``0`` (dunkel) und `` 255`` (hell).",
|
||||
"input.magneticForce": "Ruft den Wert der Magnetkraft in ``Mikro-Tesla`` (``µT``) ab. Diese Funktion wird im Simulator nicht unterstützt.",
|
||||
"input.magneticForce|param|dimension": "TODO",
|
||||
"input.onButtonPressed": "Tue etwas, wenn eine Taste (``A``, ``B`` oder ``A + B``) gedrückt wird",
|
||||
"input.onButtonPressed|param|body": "TODO",
|
||||
"input.onButtonPressed|param|button": "TODO",
|
||||
"input.onGesture": "Mache etwas, wenn eine Geste gemacht wird (wie den mini zu schütteln).",
|
||||
"input.onGesture|param|body": "TODO",
|
||||
"input.onLogoDown": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach unten zeigt und das Board vertikal ausgerichtet ist.",
|
||||
"input.onLogoDown|param|body": "TODO",
|
||||
"input.onLogoUp": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach oben zeigt und das Board vertikal ausgerichtet ist.",
|
||||
"input.onLogoUp|param|body": "TODO",
|
||||
"input.onPinPressed": "Mache etwas, wenn eine Pin gehalten wird.",
|
||||
"input.onPinPressed|param|body": "Code, der ausführt wird, wenn ein Pin gehalten wird",
|
||||
"input.onPinPressed|param|name": "Der Pin, der gehalten werden muss",
|
||||
"input.onPinReleased": "Mache etwas, wenn der Pin losgelassen wird.",
|
||||
"input.onPinReleased|param|body": "Code, der ausgeführt werden soll, wenn der Pin losgelassen wird",
|
||||
"input.onPinReleased|param|name": "Der Pin, der losgelassen werden muss",
|
||||
"input.onScreenDown": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach unten zeigt.",
|
||||
"input.onScreenDown|param|body": "TODO",
|
||||
"input.onScreenUp": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach oben zeigt.",
|
||||
"input.onScreenUp|param|body": "TODO",
|
||||
"input.onShake": "Hängt Code an, der ausgeführt wird, wenn der mini geschüttelt wird.",
|
||||
"input.onShake|param|body": "TODO",
|
||||
"input.pinIsPressed": "Ruft den Pin-Zustand (gehalten oder nicht) ab. Die Erdung muss gehalten werden, um den Stromkreis zu schließen.",
|
||||
"input.pinIsPressed|param|name": "Pin, der verwendet wird, um eine Berührung zu erkennen",
|
||||
"input.rotation": "Die Neigung und Drehung des mini Drehung auf ``X-Achse``oder ``Y-Achse``, in Grad.",
|
||||
"input.rotation|param|kind": "TODO",
|
||||
"input.runningTime": "Ruft die Anzahl der Millisekunden auf, die seit dem Einschalten vergangen sind.",
|
||||
"input.setAccelerometerRange": "Legt die Stichprobenbereich des Beschleunigungssensors in Schwerkraft fest.",
|
||||
"input.setAccelerometerRange|param|range": "Ein Wert, der die maximale Stärke der gemessenen Beschleunigung beschreibt",
|
||||
"input.temperature": "Ruft die aktuelle Temperatur in Grad Celsius (°C) ab.",
|
||||
"led": "Steuerung des LED-Bildschirms.",
|
||||
"led.brightness": "Ruft die Helligkeit des Bildschirms ab, von 0 (aus) bis 255 (volle Helligkeit).",
|
||||
"led.enable": "Schaltet das Display an und aus",
|
||||
"led.fadeIn": "Blendet die Bildschirmanzeige ein.",
|
||||
"led.fadeIn|param|ms": "TODO",
|
||||
"led.fadeOut": "Blendet die Bildschirmhelligkeit aus.",
|
||||
"led.fadeOut|param|ms": "TODO",
|
||||
"led.plot": "Schalte die angegebene LED mit Hilfe von X- und Y-Koordinaten ein (X ist horizontal, Y ist vertikal). (0,0) ist die obere linke Ecke.",
|
||||
"led.plotAll": "Schaltet alle LEDs an",
|
||||
"led.plotBarGraph": "Zeigt ein vertikales Balkendiagramm an, basierend auf dem `Wert`und dem `Hoch`-Wert. Wenn `Hoch`0 ist, wird das Diagramm automatisch angepasst.",
|
||||
"led.plotBarGraph|param|high": "maximalen Wert. Wenn dieser 0 ist, wird der Maximalwert automatisch angepasst, z.B.: 0",
|
||||
"led.plotBarGraph|param|value": "aktueller Wert zum Darstellen",
|
||||
"led.plot|param|x": "TODO",
|
||||
"led.plot|param|y": "TODO",
|
||||
"led.point": "Ruft den An/Aus-Status einer vorgegebenen LED mittels X-/Y-Koordinaten ab. (0,0) ist oben links.",
|
||||
"led.point|param|x": "TODO",
|
||||
"led.point|param|y": "TODO",
|
||||
"led.screenshot": "Macht einen Screenshot vom LED-Bildschirm und gibt ein Bild aus.",
|
||||
"led.setBrightness": "Lege die Helligkeit des Bildschirms fest, von 0 (aus) bis 255 (volle Helligkeit).",
|
||||
"led.setBrightness|param|value": "Helligkeitswert, z.B.: 255, 127, 0",
|
||||
@ -98,17 +131,12 @@
|
||||
"led.stopAnimation": "Bricht die aktuelle Animation ab und löscht andere ausstehende Animationen.",
|
||||
"led.toggle": "Schaltet ein bestimmtes Pixel ein",
|
||||
"led.toggleAll": "Invertiert die aktuelle LED-Anzeige",
|
||||
"led.toggle|param|x": "TODO",
|
||||
"led.toggle|param|y": "TODO",
|
||||
"led.unplot": "Schalte die angegebene LED mit x-und y-Koordinaten ab (X ist horizontal, y ist vertikal). (0,0) ist oben links.",
|
||||
"led.unplot|param|x": "TODO",
|
||||
"led.unplot|param|y": "TODO",
|
||||
"music": "Generierung von von Musik durch Pin ``P0``.",
|
||||
"music.beat": "Gibt die Dauer eines Taktes in Milli-Sekunden aus",
|
||||
"music.changeTempoBy": "Ändere die Geschwindigkeit um den angegebenen Betrag",
|
||||
"music.changeTempoBy|param|bpm": "Die Änderung in Schlägen pro Minute auf das Tempo, z.B.: 20",
|
||||
"music.noteFrequency": "Ruft die Frequenz einer Note ab.",
|
||||
"music.noteFrequency|param|name": "der Name der Notiz",
|
||||
"music.playTone": "Spielt einen Ton für den angegebenen Zeitraum über Pin ``P0`` ab.",
|
||||
"music.playTone|param|frequency": "Tonhöhe des abzuspielenden Tones in Hertz (Hz)",
|
||||
"music.playTone|param|ms": "Tondauer in Millisekunden (ms)",
|
||||
@ -124,21 +152,19 @@
|
||||
"pins.analogPitch|param|frequency": "TODO",
|
||||
"pins.analogPitch|param|ms": "TODO",
|
||||
"pins.analogReadPin": "Lese den Anschlusswert als Analog aus, d. h. als einen Wert zwischen 0 und 1023.",
|
||||
"pins.analogReadPin|param|name": "Pin, auf den geschrieben werden soll",
|
||||
"pins.analogSetPeriod": "Stellt die Pulsweite Modulation (PWM) des Analogausganges auf den angegebenen Wert in ** Mikrosekunden ** oder `1/1000` Millisekunden ein.\nWenn dieser Pin nicht als einen Analogausgang (mit `analog write pin`) konfiguriert ist, hat der Vorgang keine Auswirkungen.",
|
||||
"pins.analogSetPeriod|param|micros": "Zeit in Mikrosekunden. z.B.: 20000",
|
||||
"pins.analogSetPeriod|param|name": "analoger Pin, der zeitlich festgelegt werden soll",
|
||||
"pins.analogSetPitchPin": "Setzt den genutzten Pin, wenn `pins->analog pitch`angewendet wird.",
|
||||
"pins.analogSetPitchPin|param|name": "TODO",
|
||||
"pins.analogWritePin": "Legt den Wert des Verbinders auf analog fest. Der Wert muss zwischen 0 und 1023 liegen.",
|
||||
"pins.analogWritePin|param|name": "PIN-Name, auf den geschrieben werden soll",
|
||||
"pins.analogWritePin|param|value": "Wert, der auf den Pin geschrieben werden soll, zwischen ``0`` und ``1023`` z.B.: 1023,0",
|
||||
"pins.createBuffer": "Erstellt einen Null-initialisierten Zwischenspeicher.",
|
||||
"pins.createBuffer|param|size": "Anzahl der Bytes im Zwischenspeicher",
|
||||
"pins.digitalReadPin": "Lese den angegebene Pin oder Verbinder als 0 oder 1",
|
||||
"pins.digitalReadPin|param|name": "Pin, aus dem gelesen werden soll",
|
||||
"pins.digitalWritePin": "Setzt einen Pin- oder Verbinder-Wert auf 0 oder 1.",
|
||||
"pins.digitalWritePin|param|name": "Pin, auf den geschrieben werden soll",
|
||||
"pins.digitalWritePin|param|value": "Wert, der auf dem Pin 1 gesetzt werden soll, z.B. 0",
|
||||
"pins.i2cReadBuffer": "Lese `Größe`bytes aus einer 7-bit I2C-Adresse.",
|
||||
"pins.i2cReadNumber": "Lese eine Nummer aus einer 7-bit I2C-Adresse.",
|
||||
"pins.i2cWriteBuffer": "Schreibt Bytes in eine 7-bit I2C-Adresse.",
|
||||
"pins.i2cWriteNumber": "Schreibe eine Nummer in eine 7-bit I2C-Adresse.",
|
||||
"pins.map": "Definiert eine Nummer von einer Auswahl zu einer anderen um. Ein Wert ``von niedrig``wird so auf ``zu niedrig``umgeändert, ein Wert ``von hoch`` zu ``zu hoch`` etc.",
|
||||
"pins.map|param|fromHigh": "die obere Grenze des aktuellen Wertebereichs, z.B.: 1023",
|
||||
@ -148,26 +174,25 @@
|
||||
"pins.map|param|value": "Wert in Bereichen zuordnen",
|
||||
"pins.onPulsed": "Stellt diesen Pin als einen Digitaleingang ein und generiert Ereignisse, deren Zeitstempel die Dauer darstellt, in der der Pin entweder ``hoch``oder ``niedrig``war.",
|
||||
"pins.pulseDuration": "Ruft die Dauer des letzten Impulses in Mikrosendungen ab. Diese Funktion soll von einem `onPulsed`-Handler aufgerufen werden.",
|
||||
"pins.pulseIn": "Gibt die Dauer eines Pulses in Mikrosekunden an",
|
||||
"pins.servoSetPulse": "Konfiguriert diesen IO-Pin als einen analogen/PWM-Ausgang, stellt den Zeitraum auf 20 ms ein und setzt die Pulsweite fest, basieren auf dem angegeben Wert **Mikrosekunden** oder `1/1000`Millisekunden.",
|
||||
"pins.servoSetPulse|param|micros": "Impulsdauer in Mikrosekunden, z.B.: 1500",
|
||||
"pins.servoSetPulse|param|name": "PIN-Name",
|
||||
"pins.servoWritePin": "Schreibt einen Wert in den Servo, der die Welle entsprechend kontroliert. Auf einem Standard-Servo wird so der Winkel der Welle (in Grad) eingestellt, sodass sich die Welle entsprechend anpasst. Auf einem kontinuierlich drehenden Servo wird dadurch die Geschwindigkeit des Servos festgelegt, wobei ``0``die volle Geschwindigkeit in eine Richtung darstellt, ``180``die volle Geschwindigkeit in die andere, und ein Wert von ``90`` einen Stillstand erzeugt.",
|
||||
"pins.servoWritePin|param|name": "Pin, auf den geschrieben werden soll",
|
||||
"pins.servoWritePin|param|value": "Winkel oder Rotationsbeschleunigung, z.B.: 180,90,0",
|
||||
"pins.setPull": "Stellt die Anziehungskraft des Pins ein.",
|
||||
"pins.setPull|param|name": "Pin, auf dem der Pull-Modus aktiviert wird",
|
||||
"pins.setPull|param|pull": "eine der mbed-Pull-Konfigurationen: PullUp, PullDown, PullNone ",
|
||||
"pins.sizeOf": "Ruft die Bytegröße im spezifierten Nummernformat ab.",
|
||||
"pins.spiWrite": "Schreibe in den SPI-Slave und gebe die Antwort aus",
|
||||
"pins.spiWrite|param|value": "Daten, die an den SPI-Slave geschickt werden sollen",
|
||||
"serial": "Lesen und Schreiben von Daten über eine serielle Verbindung.",
|
||||
"serial.delimiters": "Gibt die mit dem Begrenzer korrespondierende Zeichenfolge aus.",
|
||||
"serial.onLineReceived": "Registriert ein Event, das ausgeführt wird, wenn eine Zeile empfangen wurde",
|
||||
"serial.readLine": "Liest eine Textzeile aus der seriellen Schnittstelle.",
|
||||
"serial.readUntil": "Liest aus eine Textzeile aus dem seriellen Anschluss und gibt den Puffer aus, wenn die Begrenzung erreicht wurde.",
|
||||
"serial.readUntil|param|delimiter": "Text-Begrenzung, die die Textblöcke voneinander trennt",
|
||||
"serial.redirect": "Konfiguriert dynamisch die serielle Instanz, damit sie andere Pins als USBTX und USBRX benutzt.",
|
||||
"serial.redirect|param|rx": "der neue Empfangs-Pin",
|
||||
"serial.redirect|param|tx": "Der neue Übertragungs-Pin",
|
||||
"serial.writeLine": "Gibt eine Zeile des Textes an die serielle",
|
||||
"serial.writeNumber": " Gibt einen numerischen Wert an die serielle",
|
||||
"serial.writeNumber": "Gibt einen numerischen Wert an die serielle",
|
||||
"serial.writeString": "Sendet ein Stück Text über serielle Verbindung.",
|
||||
"serial.writeValue": "Schreibt ein ``Namen: Wert`` Wertepaar auf die serielle Schnittstelle.",
|
||||
"serial.writeValue|param|name": "Name des Wertestreams, z.B.: x",
|
||||
|
@ -1,20 +1,106 @@
|
||||
{
|
||||
"Math.randomBoolean|block": "Wähle zufälligen Wahr- oder Falsch-Wert",
|
||||
"AcceleratorRange.EightG": "Der Bewegungssensor misst Kräfte bis 8g",
|
||||
"AcceleratorRange.EightG|block": "8g",
|
||||
"AcceleratorRange.FourG": "Der Bewegungssensor misst Kräfte bis 4g",
|
||||
"AcceleratorRange.FourG|block": "4g",
|
||||
"AcceleratorRange.OneG": "Der Bewegungssensor misst Kräfte bis 1g",
|
||||
"AcceleratorRange.OneG|block": "1g",
|
||||
"AcceleratorRange.TwoG": "Der Bewegungssensor misst Kräfte bis 2g",
|
||||
"AcceleratorRange.TwoG|block": "2g",
|
||||
"BaudRate.BaudRate115200|block": "11520",
|
||||
"BaudRate.BaudRate9600|block": "9600",
|
||||
"BeatFraction.Eighth|block": "1/8",
|
||||
"BeatFraction.Half|block": "1/2",
|
||||
"BeatFraction.Quarter|block": "1/4",
|
||||
"BeatFraction.Sixteenth|block": "1/16",
|
||||
"BeatFraction.Whole|block": "1",
|
||||
"Button.AB|block": "A+B",
|
||||
"Delimiters.Dollar|block": "$",
|
||||
"Delimiters.Hash|block": "#",
|
||||
"Delimiters.NewLine|block": "Neue Zeile",
|
||||
"Dimension.Strength|block": "Stärke",
|
||||
"Dimension.X|block": "x",
|
||||
"Dimension.Y|block": "y",
|
||||
"Dimension.Z|block": "z",
|
||||
"Direction.Left|block": "links",
|
||||
"Direction.Right|block": "rechts",
|
||||
"DisplayMode.BackAndWhite|block": "Schwarz-Weiß",
|
||||
"DisplayMode.Greyscale|block": "Graustufen",
|
||||
"EventCreationMode.CreateAndFire": "Calliope mini-Event wurde initialisiert, seine Event-Handler werden unverzüglich ausgeführt (nicht geeignet für die Nutzung bei Unterbrechungen!).",
|
||||
"EventCreationMode.CreateOnly": "Calliope mini-Event wurde initialisiert, es wird keine weitere Verarbeitung vorgenommen.",
|
||||
"Gesture.EightG|block": "8g",
|
||||
"Gesture.FreeFall": "Wird ausgeführt, wenn das Board fällt!",
|
||||
"Gesture.FreeFall|block": "freier Fall",
|
||||
"Gesture.LogoDown": "Wird ausgeführt, wenn das Logo nach unten zeigt und das Display vertikal ist.",
|
||||
"Gesture.LogoDown|block": "Logo nach unten",
|
||||
"Gesture.LogoUp": "Wird ausgeführt, wenn das Logo nach oben zeigt und das Display vertikal ist.",
|
||||
"Gesture.LogoUp|block": "Logo oben",
|
||||
"Gesture.ScreenDown": "Wird ausgeführt, wenn das Display nach oben zeigt und das Board horizontal ist.",
|
||||
"Gesture.ScreenDown|block": "Display nach unten",
|
||||
"Gesture.ScreenUp": "Wird ausgeführt, wenn das Display nach unten zeigt und das Board horizontal ist.",
|
||||
"Gesture.ScreenUp|block": "Display nach oben",
|
||||
"Gesture.Shake": "Wird erhöht, wenn geschüttelt",
|
||||
"Gesture.Shake|block": "geschüttelt",
|
||||
"Gesture.SixG": "Wird ausgeführt, ein 6g starker Stoß erkannt wird",
|
||||
"Gesture.SixG|block": "6g",
|
||||
"Gesture.ThreeG": "Wird ausgeführt, ein 3g starker Stoß erkannt wird",
|
||||
"Gesture.ThreeG|block": "3g",
|
||||
"Gesture.TiltLeft": "Wird ausgeführt, wenn das Display nach links zeigt",
|
||||
"Gesture.TiltLeft|block": "nach links neigen",
|
||||
"Gesture.TiltRight": "Wird ausgeführt, wenn das Display nach rechts zeigt",
|
||||
"Gesture.TiltRight|block": "nach rechts neigen",
|
||||
"LedSpriteProperty.Blink|block": "blinken",
|
||||
"LedSpriteProperty.Brightness|block": "Helligkeit",
|
||||
"LedSpriteProperty.Direction|block": "Richtung",
|
||||
"LedSpriteProperty.X|block": "x",
|
||||
"LedSpriteProperty.Y|block": "y",
|
||||
"Math.randomBoolean|block": "wähle zufälligen Wahr- oder Falsch-Wert",
|
||||
"Math|block": "Mathematik",
|
||||
"Note.CSharp3|block": "C#3",
|
||||
"Note.CSharp4|block": "C#4",
|
||||
"Note.CSharp5|block": "C#5",
|
||||
"Note.CSharp|block": "C#",
|
||||
"Note.FSharp3|block": "F#3",
|
||||
"Note.FSharp4|block": "F#4",
|
||||
"Note.FSharp5|block": "F#5",
|
||||
"Note.FSharp|block": "F#",
|
||||
"Note.GSharp3|block": "G#3",
|
||||
"Note.GSharp4|block": "G#4",
|
||||
"Note.GSharp5|block": "G#5",
|
||||
"Note.GSharp|block": "G#",
|
||||
"PinPullMode.PullDown|block": "nach unten",
|
||||
"PinPullMode.PullUp|block": "nach oben",
|
||||
"Rotation.Pitch|block": "Winkel",
|
||||
"Rotation.Roll|block": "rollen",
|
||||
"String.charAt|block": "Zeichen an Position %pos aus|%this",
|
||||
"String.compare|block": "vergleiche %this| mit %that",
|
||||
"String.concat|block": "hänge %this| mit %other aneinander",
|
||||
"String.fromCharCode|block": "Text aus char code %code",
|
||||
"String.isEmpty|block": "%this| ist leer",
|
||||
"String.length|block": "Länge von %VALUE",
|
||||
"String.substr|block": "extrahiere aus %this|beginnend mit %start|%length Zeichen",
|
||||
"String|block": "Zeichenfolge",
|
||||
"basic.clearScreen|block": "Bildschirminhalt löschen",
|
||||
"basic.forever|block": "dauerhaft",
|
||||
"basic.pause|block": "Pausiere (ms) %pause",
|
||||
"basic.showLeds|block": "Zeige LEDs",
|
||||
"basic.showNumber|block": "Zeige|Nummer %number",
|
||||
"basic.showString|block": "Zeige|Zeichenfolge %text",
|
||||
"basic.pause|block": "pausiere (ms) %pause",
|
||||
"basic.showLeds|block": "zeige LEDs",
|
||||
"basic.showNumber|block": "zeige|Nummer %number",
|
||||
"basic.showString|block": "zeige|Zeichenfolge %text",
|
||||
"basic|block": "Grundlagen",
|
||||
"control.deviceName|block": "Gerätename",
|
||||
"control.deviceSerialNumber|block": "Seriennnummer",
|
||||
"control.eventSourceId|block": "%id",
|
||||
"control.eventTimestamp|block": "Ereigniszeitstempel",
|
||||
"control.eventValueId|block": "%id",
|
||||
"control.eventValue|block": "Ereigniswert",
|
||||
"control.inBackground|block": "im Hintergrund ausführen",
|
||||
"control.onEvent|block": "wenn Ereignis|von Quelle %src=control_event_source_id|mit Wert %value=control_event_value_id",
|
||||
"control.raiseEvent|block": "Ereignis auslösen|von Quelle %src=control_event_source_id|mit Wert %value=control_event_value_id",
|
||||
"control.reset|block": "zurücksetzen",
|
||||
"control.waitMicros|block": "Warte (µs)%micros",
|
||||
"control|block": "Steuerung",
|
||||
"game.addScore|block": "Ändere Spielstand um|%points",
|
||||
"game.createSprite|block": "erzeuge Sprite an Position|x: %x|y:%y",
|
||||
"game.gameOver|block": "Spiel beendet",
|
||||
"game.score|block": "Spielstand",
|
||||
"game.startCountdown|block": "Countdown| starten (ms) %duration",
|
||||
@ -27,49 +113,50 @@
|
||||
"input.compassHeading|block": "Kompassausrichtung (°)",
|
||||
"input.lightLevel|block": "Lichtstärke",
|
||||
"input.magneticForce|block": "Magnetkraft (µT) |%NAME",
|
||||
"input.onButtonPressed|block": "Wenn Button|%NAME|gedrückt",
|
||||
"input.onButtonPressed|block": "wenn Knopf|%NAME|gedrückt",
|
||||
"input.onGesture|block": "wenn |%NAME",
|
||||
"input.onPinPressed|block": "wenn pin %NAME|gedrückt",
|
||||
"input.onPinReleased|block": "Wenn pin %NAME|released",
|
||||
"input.pinIsPressed|block": "PIN %NAME|ist gedrückt",
|
||||
"input.onPinReleased|block": "wenn Pin %NAME|losgelassen",
|
||||
"input.pinIsPressed|block": "Pin %NAME|ist gedrückt",
|
||||
"input.rotation|block": "Rotation (°)|%NAME",
|
||||
"input.runningTime|block": "Laufzeit (ms)",
|
||||
"input.setAccelerometerRange|block": "Setze Bewegungsmesser|range %range",
|
||||
"input.setAccelerometerRange|block": "setze Bewegungsmesser auf|%range",
|
||||
"input.temperature|block": "Temperatur (°C)",
|
||||
"input|block": "Eingabe",
|
||||
"led.brightness|block": "Helligkeit",
|
||||
"led.plotBarGraph|block": "zeichne Balkendiagramm des %value|bis %high",
|
||||
"led.plotBarGraph|block": "zeichne Balkendiagramm von %value|bis %high",
|
||||
"led.plot|block": "Zeichne|x %x|y %y",
|
||||
"led.point|block": "Punkt|x %x|y %y",
|
||||
"led.setBrightness|block": "Setze Helligkeit auf %value",
|
||||
"led.stopAnimation|block": "Halte Animation an",
|
||||
"led.toggle|block": "Schalte zwischen|x %x|y %y",
|
||||
"led.unplot|block": "Unplot|x %x|y %y",
|
||||
"led.unplot|block": "schalte Pixel|x %x|y %y aus",
|
||||
"led|block": "LED",
|
||||
"music.beat|block": "%fraction|Takt",
|
||||
"music.changeTempoBy|block": "ändere die Geschwindigkeit (bpm)|%value",
|
||||
"music.noteFrequency|block": "%note",
|
||||
"music.playTone|block": "play|tone %note=device_note|for %duration=device_beat",
|
||||
"music.rest|block": "rest(ms)|%duration=device_beat",
|
||||
"music.playTone|block": "spiele|Note %note=device_note|für %duration=device_beat",
|
||||
"music.rest|block": "pausiere (ms)|%duration=device_beat",
|
||||
"music.ringTone|block": "Klingelton (Hz) |%note = Device_note",
|
||||
"music.setTempo|block": "ändere Geschwindigkeit auf (bpm)|%value",
|
||||
"music.tempo|block": "Geschwindkeit (bpm)",
|
||||
"music|block": "Musik",
|
||||
"pins.analogReadPin|block": "analog read|pin %name",
|
||||
"pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros",
|
||||
"pins.analogWritePin|block": "analog write|pin %name|to %value",
|
||||
"pins.digitalReadPin|block": "digital read|pin %name",
|
||||
"pins.digitalWritePin|block": "digital write|pin %name|to %value",
|
||||
"pins.i2cReadNumber|block": "i2c read number|at address %address|of format %format=i2c_sizeof",
|
||||
"pins.i2cWriteNumber|block": "i2c write number|at address %address|with value %value|of format %format=i2c_sizeof",
|
||||
"pins.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh",
|
||||
"pins.onPulsed|block": "on|pin %pin|pulsed %pulse",
|
||||
"pins.analogReadPin|block": "lese analoge Werte von|Pin %name",
|
||||
"pins.analogSetPeriod|block": "setze Zeitraum für analogen|Pin %pin|auf (µs)%micros",
|
||||
"pins.analogWritePin|block": "schreibe analogen|Pin %name|auf %value",
|
||||
"pins.digitalReadPin|block": "lese digitale Werte von|Pin %name",
|
||||
"pins.digitalWritePin|block": "schreibe digitalen Wert von|pin %name|auf %value",
|
||||
"pins.i2cReadNumber|block": "lese Nummer aus I2C|auf Adresse %address|im Format %format=i2c_sizeof",
|
||||
"pins.i2cWriteNumber|block": "schreibe Nummer aus I2C|auf Adresse %address|mit Wert %value|im Format %format=i2c_sizeof",
|
||||
"pins.map|block": "verteile %value|von niedrig %fromLow|von hoch %fromHigh| bis niedrig %toLow|bis hoch %toHigh",
|
||||
"pins.onPulsed|block": "wenn|Pin %pin|gepulst %pulse",
|
||||
"pins.pulseDuration|block": "Impulsdauer (µs)",
|
||||
"pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros",
|
||||
"pins.servoWritePin|block": "servo write|pin %name|to %value",
|
||||
"pins.setPull|block": "set pull|pin %pin|to %pull",
|
||||
"pins.spiWrite|block": "spi write %value",
|
||||
"pins.pulseIn|block": "Impuls in (µs)|Pin %name|mit %value",
|
||||
"pins.servoSetPulse|block": "setze den Puls von Servo an|Pin %value|auf (µs) %micros",
|
||||
"pins.servoWritePin|block": "schreibe Servo an|Pin %name|auf %value",
|
||||
"pins.setPull|block": "setze Anziehungskraft von|Pin %pin|auf %pull",
|
||||
"pins.spiWrite|block": "schreibe %value in SPI",
|
||||
"pins|block": "Pins",
|
||||
"serial.delimiters|block": "%del",
|
||||
"serial.readLine|block": "serial|read line",
|
||||
"serial.readUntil|block": "serial|read until %delimiter=serial_delimiter_conv",
|
||||
"serial.redirect|block": "serial|redirect to|TX %tx|RX %rx|at baud rate %rate",
|
||||
@ -87,5 +174,7 @@
|
||||
"{id:category}Math": "Mathematik",
|
||||
"{id:category}Music": "Musik",
|
||||
"{id:category}Pins": "Pins",
|
||||
"{id:category}Serial": "Serielle"
|
||||
"{id:category}Serial": "Serielle",
|
||||
"{id:category}String": "Zeichenfolge",
|
||||
"{id:category}Text": "Text"
|
||||
}
|
@ -1,31 +1,6 @@
|
||||
{
|
||||
"Math.abs": "",
|
||||
"Math.abs|param|x": "",
|
||||
"Math.max": "",
|
||||
"Math.min": "",
|
||||
"Math.pow": "",
|
||||
"Math.pow|param|x": "",
|
||||
"Math.pow|param|y": "",
|
||||
"Math.random": "",
|
||||
"Math.randomBoolean": "Génère une valeur « true » ou « false » au hasard, comme si vous lanciez une pièce de monnaie.",
|
||||
"Math.sign": "",
|
||||
"Math.sign|param|x": "",
|
||||
"Math.sqrt": "",
|
||||
"Math.sqrt|param|x": "",
|
||||
"String.charAt": "",
|
||||
"String.charAt|param|index": "",
|
||||
"String.charCodeAt": "",
|
||||
"String.charCodeAt|param|index": "",
|
||||
"String.compare": "",
|
||||
"String.compare|param|that": "",
|
||||
"String.concat": "",
|
||||
"String.concat|param|other": "",
|
||||
"String.fromCharCode": "Construit une chaîne à partir du code ASCII d'un caractère donné.",
|
||||
"String.isEmpty": "",
|
||||
"String.length": "",
|
||||
"String.substr": "",
|
||||
"String.substr|param|length": "",
|
||||
"String.substr|param|start": "",
|
||||
"basic": "Permet d’accéder aux fonctionnalités de base de la micro:bit.",
|
||||
"basic.clearScreen": "Éteindre toutes les LEDs",
|
||||
"basic.forever": "Répète le code indéfiniment en tâche de fond. A chaque itération, permet aux autres codes de s’exécuter.",
|
||||
@ -44,200 +19,44 @@
|
||||
"basic.showString": "Afficher du texte à l’écran, un caractère à la fois. Si la chaîne rentre sur l’écran (c'est-à-dire une seule lettre), ne défile pas.",
|
||||
"basic.showString|param|interval": "à quelle vitesse se déplacent les caractères ; par ex. : 150, 100, 200, -100",
|
||||
"basic.showString|param|text": "le texte à faire défiler sur l’écran, par exemple : « Bonjour ! »",
|
||||
"control": "",
|
||||
"control.assert": "",
|
||||
"control.deviceName": "",
|
||||
"control.deviceSerialNumber": "",
|
||||
"control.eventSourceId": "",
|
||||
"control.eventTimestamp": "",
|
||||
"control.eventValue": "",
|
||||
"control.eventValueId": "",
|
||||
"control.inBackground": "Planifie le code qui s’exécute en arrière-plan.",
|
||||
"control.onEvent": "",
|
||||
"control.panic": "",
|
||||
"control.raiseEvent": "",
|
||||
"control.raiseEvent|param|mode": "",
|
||||
"control.raiseEvent|param|src": "",
|
||||
"control.raiseEvent|param|value": "",
|
||||
"control.reset": "Réinitialise le micro:bit de BBC.",
|
||||
"control.runtimeWarning": "",
|
||||
"control.waitMicros": "",
|
||||
"control.waitMicros": "Bloque la fibre courante pour le nombre de microsecondes donné",
|
||||
"control.waitMicros|param|micros": "nombre de microsecondes à attendre. par ex. : 4",
|
||||
"game": "Un moteur de jeu avec une unique LED",
|
||||
"game.addLife": "",
|
||||
"game.addLife|param|lives": "",
|
||||
"game.addScore": "Ajoute des points au score actuel",
|
||||
"game.addScore|param|points": "nombre de points à changer, par ex. : 1",
|
||||
"game.createSprite": "",
|
||||
"game.createSprite|param|x": "",
|
||||
"game.createSprite|param|y": "",
|
||||
"game.currentTime": "",
|
||||
"game.gameOver": "Affiche un animation de fin de jeu.",
|
||||
"game.invalidSprite": "",
|
||||
"game.isGameOver": "",
|
||||
"game.isRunning": "",
|
||||
"game.level": "",
|
||||
"game.levelUp": "",
|
||||
"game.life": "",
|
||||
"game.removeLife": "",
|
||||
"game.removeLife|param|life": "",
|
||||
"game.score": "Obtient le score actuel",
|
||||
"game.setLife": "",
|
||||
"game.setLife|param|value": "",
|
||||
"game.setScore": "Définit la valeur du score actuel",
|
||||
"game.setScore|param|value": "",
|
||||
"game.showScore": "",
|
||||
"game.startCountdown": "",
|
||||
"game.startCountdown|param|ms": "",
|
||||
"game.startStopwatch": "",
|
||||
"images": "",
|
||||
"images.createBigImage": "",
|
||||
"images.createImage": "",
|
||||
"input": "",
|
||||
"input.acceleration": "",
|
||||
"input.acceleration|param|dimension": "",
|
||||
"input.buttonIsPressed": "",
|
||||
"input.calibrate": "",
|
||||
"input.compassHeading": "",
|
||||
"input.lightLevel": "",
|
||||
"input.magneticForce": "",
|
||||
"input.magneticForce|param|dimension": "",
|
||||
"input.onButtonPressed": "",
|
||||
"input.onButtonPressed|param|body": "",
|
||||
"input.onButtonPressed|param|button": "",
|
||||
"input.onGesture": "",
|
||||
"input.onGesture|param|body": "",
|
||||
"input.onLogoDown": "",
|
||||
"input.onLogoDown|param|body": "",
|
||||
"input.onLogoUp": "",
|
||||
"input.onLogoUp|param|body": "",
|
||||
"input.onPinPressed": "",
|
||||
"input.onPinPressed|param|body": "",
|
||||
"input.onPinPressed|param|name": "",
|
||||
"input.onPinReleased": "",
|
||||
"input.onPinReleased|param|body": "",
|
||||
"input.onPinReleased|param|name": "",
|
||||
"input.onScreenDown": "",
|
||||
"input.onScreenDown|param|body": "",
|
||||
"input.onScreenUp": "",
|
||||
"input.onScreenUp|param|body": "",
|
||||
"input.onShake": "",
|
||||
"input.onShake|param|body": "",
|
||||
"input.pinIsPressed": "",
|
||||
"input.pinIsPressed|param|name": "",
|
||||
"input.rotation": "",
|
||||
"input.rotation|param|kind": "",
|
||||
"input.runningTime": "",
|
||||
"input.setAccelerometerRange": "",
|
||||
"input.setAccelerometerRange|param|range": "",
|
||||
"input.temperature": "",
|
||||
"led": "",
|
||||
"led.brightness": "",
|
||||
"led.enable": "",
|
||||
"led.fadeIn": "",
|
||||
"led.fadeIn|param|ms": "",
|
||||
"led.fadeOut": "",
|
||||
"led.fadeOut|param|ms": "",
|
||||
"led.plot": "",
|
||||
"led.plotAll": "",
|
||||
"led.plotBarGraph": "",
|
||||
"led.plotBarGraph|param|high": "",
|
||||
"led.plotBarGraph|param|value": "",
|
||||
"led.plot|param|x": "",
|
||||
"led.plot|param|y": "",
|
||||
"led.point": "",
|
||||
"led.point|param|x": "",
|
||||
"led.point|param|y": "",
|
||||
"led.screenshot": "",
|
||||
"led.setBrightness": "",
|
||||
"led.setBrightness|param|value": "",
|
||||
"led.setDisplayMode": "",
|
||||
"led.setDisplayMode|param|mode": "",
|
||||
"led.stopAnimation": "",
|
||||
"led.toggle": "",
|
||||
"led.toggleAll": "",
|
||||
"led.toggle|param|x": "",
|
||||
"led.toggle|param|y": "",
|
||||
"led.unplot": "",
|
||||
"led.unplot|param|x": "",
|
||||
"led.unplot|param|y": "",
|
||||
"music": "",
|
||||
"music.beat": "",
|
||||
"music.changeTempoBy": "",
|
||||
"music.changeTempoBy|param|bpm": "",
|
||||
"music.noteFrequency": "",
|
||||
"music.noteFrequency|param|name": "",
|
||||
"music.playTone": "",
|
||||
"music.playTone|param|frequency": "",
|
||||
"music.playTone|param|ms": "",
|
||||
"game.startCountdown": "Démarre un compte à rebours de jeu",
|
||||
"game.startCountdown|param|ms": "durée du compte à rebours en millisecondes, par ex. : 10000",
|
||||
"images": "Création, manipulation et affichage d’images LED.",
|
||||
"images.createBigImage": "Crée une image à partir de 2 images.",
|
||||
"images.createImage": "Crée une image qui s’adapte aux dimensions de l’écran LED.",
|
||||
"input": "Événements et des données provenant de capteurs",
|
||||
"input.acceleration": "Donne la valeur de l'accélération en milli-g (quand la carte est à plat avec l'écran vers le haut, x=0, y=0 et z=-1024)",
|
||||
"input.buttonIsPressed": "Donne l'état du bouton (appuyé ou non) pour ``A`` et ``B``.",
|
||||
"input.calibrate": "Obsolète, le calibrage de la boussole est automatique.",
|
||||
"input.compassHeading": "Obtient la direction actuelle du compas en degrés.",
|
||||
"input.lightLevel": "Lit le niveau de lumière appliqué à l'écran LED de ``0`` (sombre) à ``255`` lumineux.",
|
||||
"input.magneticForce": "Obtenir la valeur de la force magnétique en ``micro-Teslas`` (``µT``). Cette fonction n’est pas supportée par le simulateur.",
|
||||
"input.onButtonPressed": "Faire quelque chose quand un bouton (``A``, ``B`` ou les deux ``A+B``) est appuyé",
|
||||
"input.onGesture": "Faire quelque chose lorsque lorsqu’un geste est fait (par exemple secouer le micro:bit).",
|
||||
"input.onPinPressed": "Faire quelque chose lorsque vous appuyez sur une broche.",
|
||||
"input.onPinPressed|param|body": "code à exécuter lorsque la broche est enfoncée",
|
||||
"input.onPinReleased": "Faire quelque chose quand une broche est relâchée.",
|
||||
"input.onPinReleased|param|body": "le code à exécuter lorsque la broche est relâchée",
|
||||
"input.pinIsPressed": "Donne l’état de la broche (pressée ou non). Nécessite de tenir la masse pour fermer le circuit.",
|
||||
"input.runningTime": "Donne le nombre de millisecondes écoulées depuis la mise en route.",
|
||||
"input.temperature": "Obtient la température en degrés Celsius (°C).",
|
||||
"led": "Contrôle de l’écran LED.",
|
||||
"led.enable": "Active ou désactive l’affichage",
|
||||
"led.plotAll": "Allume toutes les LEDS",
|
||||
"led.plotBarGraph|param|value": "valeur actuelle à tracer",
|
||||
"led.setBrightness|param|value": "valeur de la luminosité, par ex. : 255, 127, 0",
|
||||
"music.rest": "Repose (joue rien) pendant une durée spécifiée via broche '' P0''.",
|
||||
"music.rest|param|ms": "",
|
||||
"music.ringTone": "",
|
||||
"music.ringTone|param|frequency": "",
|
||||
"music.setTempo": "",
|
||||
"music.setTempo|param|bpm": "",
|
||||
"music.tempo": "",
|
||||
"pins": "",
|
||||
"pins.analogPitch": "",
|
||||
"pins.analogPitch|param|frequency": "",
|
||||
"pins.analogPitch|param|ms": "",
|
||||
"pins.analogReadPin": "",
|
||||
"pins.analogReadPin|param|name": "",
|
||||
"pins.analogSetPeriod": "",
|
||||
"pins.analogSetPeriod|param|micros": "",
|
||||
"pins.analogSetPeriod|param|name": "",
|
||||
"pins.analogSetPitchPin": "",
|
||||
"pins.analogSetPitchPin|param|name": "",
|
||||
"pins.analogWritePin": "",
|
||||
"pins.analogWritePin|param|name": "",
|
||||
"pins.analogWritePin|param|value": "",
|
||||
"pins.createBuffer": "",
|
||||
"pins.createBuffer|param|size": "",
|
||||
"pins.digitalReadPin": "",
|
||||
"pins.digitalReadPin|param|name": "",
|
||||
"pins.digitalWritePin": "",
|
||||
"pins.digitalWritePin|param|name": "",
|
||||
"pins.digitalWritePin|param|value": "",
|
||||
"pins.i2cReadBuffer": "",
|
||||
"pins.i2cReadNumber": "",
|
||||
"pins.i2cWriteBuffer": "",
|
||||
"pins.i2cWriteNumber": "",
|
||||
"pins.map": "",
|
||||
"pins.map|param|fromHigh": "",
|
||||
"pins.map|param|fromLow": "",
|
||||
"pins.map|param|toHigh": "",
|
||||
"pins.map|param|toLow": "",
|
||||
"pins.map|param|value": "",
|
||||
"pins.onPulsed": "",
|
||||
"pins.pulseDuration": "",
|
||||
"pins.pulseIn": "",
|
||||
"pins.pulseIn|param|name": "",
|
||||
"pins.pulseIn|param|value": "",
|
||||
"pins.servoSetPulse": "",
|
||||
"pins.servoSetPulse|param|micros": "",
|
||||
"pins.servoSetPulse|param|name": "",
|
||||
"pins.servoWritePin": "",
|
||||
"pins.servoWritePin|param|name": "",
|
||||
"pins.servoWritePin|param|value": "",
|
||||
"pins.setPull": "",
|
||||
"pins.setPull|param|name": "",
|
||||
"pins.setPull|param|pull": "",
|
||||
"pins.sizeOf": "",
|
||||
"pins.spiWrite": "",
|
||||
"pins.spiWrite|param|value": "",
|
||||
"serial": "",
|
||||
"serial.delimiters": "",
|
||||
"serial.onLineReceived": "",
|
||||
"serial.readLine": "",
|
||||
"serial.readUntil": "",
|
||||
"serial.readUntil|param|delimiter": "",
|
||||
"serial.redirect": "",
|
||||
"serial.redirect|param|rx": "",
|
||||
"serial.redirect|param|tx": "",
|
||||
"serial.writeLine": "",
|
||||
"serial.writeNumber": "",
|
||||
"serial.writeString": "",
|
||||
"serial.writeValue": "",
|
||||
"serial.writeValue|param|name": "",
|
||||
"serial.writeValue|param|value": ""
|
||||
"pins.analogPitch|param|frequency": "TODO",
|
||||
"pins.analogPitch|param|ms": "TODO",
|
||||
"pins.analogSetPitchPin|param|name": "TODO"
|
||||
}
|
@ -1,35 +1,21 @@
|
||||
{
|
||||
"LedSpriteProperty.Brightness|block": "luminosité",
|
||||
"Math.randomBoolean|block": "choisir au hasard vrai ou faux",
|
||||
"Math|block": "Maths",
|
||||
"String.charAt|block": "",
|
||||
"String.compare|block": "",
|
||||
"String.concat|block": "",
|
||||
"String.fromCharCode|block": "texte du code de charactère %code",
|
||||
"String.isEmpty|block": "",
|
||||
"String.length|block": "",
|
||||
"String.substr|block": "",
|
||||
"String|block": "Texte",
|
||||
"basic.clearScreen|block": "effacer l’écran",
|
||||
"basic.forever|block": "toujours",
|
||||
"basic.pause|block": "pause (ms) %pause",
|
||||
"basic.showLeds|block": "montrer LEDs",
|
||||
"basic.showNumber|block": "montrer|nombre %number",
|
||||
"basic.showString|block": "montrer|texte %text",
|
||||
"basic.showString|block": "afficher|texte %text",
|
||||
"basic|block": "base",
|
||||
"control.deviceName|block": "",
|
||||
"control.deviceSerialNumber|block": "",
|
||||
"control.eventSourceId|block": "",
|
||||
"control.eventTimestamp|block": "",
|
||||
"control.eventValueId|block": "",
|
||||
"control.eventValue|block": "",
|
||||
"control.inBackground|block": "exécuter en arrière-plan",
|
||||
"control.onEvent|block": "",
|
||||
"control.raiseEvent|block": "",
|
||||
"control.reset|block": "remise à zéro",
|
||||
"control.waitMicros|block": "attendre (µs) %micros",
|
||||
"control|block": "contrôle",
|
||||
"game.addScore|block": "changer le score par|%points",
|
||||
"game.createSprite|block": "",
|
||||
"game.gameOver|block": "fin du jeu",
|
||||
"game.score|block": "score",
|
||||
"game.startCountdown|block": "commencer compte à rebours|(ms) %duration",
|
||||
@ -44,7 +30,6 @@
|
||||
"input.magneticForce|block": "force magnétique (µT) |%NAME",
|
||||
"input.onButtonPressed|block": "lorsque le button|%NAME|est pressé",
|
||||
"input.onGesture|block": "lorsque|%NAME",
|
||||
"input.onPinPressed|block": "lorsque le pin %NAME|est pressé",
|
||||
"input.onPinReleased|block": "lorsque la broche %NAME|est lachée",
|
||||
"input.pinIsPressed|block": "broche %NAME| est pressée",
|
||||
"input.rotation|block": "rotation (°)|%NAME",
|
||||
@ -71,22 +56,15 @@
|
||||
"music.tempo|block": "tempo (bpm)",
|
||||
"music|block": "musique",
|
||||
"pins.analogReadPin|block": "lire|la broche analogique %name",
|
||||
"pins.analogSetPeriod|block": "",
|
||||
"pins.analogWritePin|block": "",
|
||||
"pins.digitalReadPin|block": "lire en numérique|broche %name",
|
||||
"pins.digitalWritePin|block": "écrire en numérique|la broche %name|à %value",
|
||||
"pins.i2cReadNumber|block": "i2c lire nombre|à l’adresse %address|de format %format=i2c_sizeof",
|
||||
"pins.i2cWriteNumber|block": "i2c écrire nombre|à l’adresse %address|avec value %value|de format %format=i2c_sizeof",
|
||||
"pins.map|block": "",
|
||||
"pins.onPulsed|block": "lorsque|la broche %pin|est pulsée %pulse",
|
||||
"pins.pulseDuration|block": "durée de l’impulsion (µs)",
|
||||
"pins.pulseIn|block": "",
|
||||
"pins.servoSetPulse|block": "",
|
||||
"pins.servoWritePin|block": "servo écrire|broche %name|à %value",
|
||||
"pins.setPull|block": "",
|
||||
"pins.spiWrite|block": "spi écrire %value",
|
||||
"pins|block": "broches",
|
||||
"serial.delimiters|block": "",
|
||||
"serial.readLine|block": "série|lire ligne",
|
||||
"serial.readUntil|block": "série|lire jusque %delimiter=serial_delimiter_conv",
|
||||
"serial.redirect|block": "série|rediriger vers|TX %tx|RX %rx|au débit en baudes %rate",
|
||||
@ -105,6 +83,5 @@
|
||||
"{id:category}Music": "Musique",
|
||||
"{id:category}Pins": "Broches",
|
||||
"{id:category}Serial": "Communication Série",
|
||||
"{id:category}String": "Texte",
|
||||
"{id:category}Text": ""
|
||||
"{id:category}String": "Texte"
|
||||
}
|
82
libs/core/_locales/ja/core-strings.json
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"AcceleratorRange.EightG": "8Gまでの加速度を測ります。",
|
||||
"AcceleratorRange.EightG|block": "8G",
|
||||
"AcceleratorRange.FourG": "4Gまでの加速度を測ります。",
|
||||
"AcceleratorRange.FourG|block": "4G",
|
||||
"AcceleratorRange.OneG": "1Gまでの加速度を測ります。",
|
||||
"AcceleratorRange.OneG|block": "1G",
|
||||
"AcceleratorRange.TwoG": "2Gまでの加速度を測ります。",
|
||||
"AcceleratorRange.TwoG|block": "2G",
|
||||
"BaudRate.BaudRate115200|block": "115200",
|
||||
"BaudRate.BaudRate9600|block": "9600",
|
||||
"BeatFraction.Breve|block": "4",
|
||||
"BeatFraction.Double|block": "2",
|
||||
"BeatFraction.Eighth|block": "1/8",
|
||||
"BeatFraction.Half|block": "1/2",
|
||||
"BeatFraction.Quarter|block": "1/4",
|
||||
"BeatFraction.Sixteenth|block": "1/16",
|
||||
"BeatFraction.Whole|block": "1",
|
||||
"Button.AB|block": "A+B",
|
||||
"Delimiters.Dollar|block": "$",
|
||||
"Delimiters.Hash|block": "#",
|
||||
"Delimiters.NewLine|block": "改行",
|
||||
"Gesture.EightG": "8Gの衝撃があったときに発生します。",
|
||||
"Gesture.EightG|block": "8G",
|
||||
"Gesture.FreeFall": "ボードを落としたときに発生します。",
|
||||
"Gesture.FreeFall|block": "落とした",
|
||||
"Gesture.LogoDown": "画面が垂直で、ロゴの位置が下になったときに発生します。",
|
||||
"Gesture.LogoDown|block": "ロゴが下になった",
|
||||
"Gesture.LogoUp": "画面が垂直で、ロゴの位置が上になったときに発生します。",
|
||||
"Gesture.LogoUp|block": "ロゴが上になった",
|
||||
"Gesture.ScreenDown": "ボードが水平で、画面が下向きになったときに発生します。",
|
||||
"Gesture.ScreenDown|block": "画面が下になった",
|
||||
"Gesture.ScreenUp": "ボードが水平で、画面が上向きになったときに発生します。",
|
||||
"Gesture.ScreenUp|block": "画面が上になった",
|
||||
"Gesture.Shake": "ボードがゆさぶられたときに発生します。",
|
||||
"Gesture.Shake|block": "ゆさぶられた",
|
||||
"Gesture.SixG": "6Gの衝撃があったときに発生します。",
|
||||
"Gesture.SixG|block": "6G",
|
||||
"Gesture.ThreeG": "3Gの衝撃があったときに発生します。",
|
||||
"Gesture.ThreeG|block": "3G",
|
||||
"Gesture.TiltLeft": "画面を左に傾けたときに発生します。",
|
||||
"Gesture.TiltLeft|block": "左に傾けた",
|
||||
"Gesture.TiltRight": "画面を右に傾けたときに発生します。",
|
||||
"Gesture.TiltRight|block": "右に傾けた",
|
||||
"LedSpriteProperty.Brightness|block": "明るさ",
|
||||
"Math.randomBoolean|block": "真または偽をランダムに選ぶ",
|
||||
"Math|block": "計算",
|
||||
"String.fromCharCode|block": "文字コード %code|の文字",
|
||||
"basic.clearScreen|block": "表示を消す",
|
||||
"basic.forever|block": "ずっと",
|
||||
"basic.pause|block": "ひと休み(ミリ秒) %pause",
|
||||
"basic.showLeds|block": "LEDに表示",
|
||||
"basic.showNumber|block": "数を表示|%number",
|
||||
"basic.showString|block": "文字列を表示|%text",
|
||||
"basic|block": "基本",
|
||||
"control.inBackground|block": "バックグラウンドで実行する",
|
||||
"control.reset|block": "リセット",
|
||||
"control|block": "制御",
|
||||
"game.gameOver|block": "ゲームオーバー",
|
||||
"game|block": "ゲーム",
|
||||
"images.createBigImage|block": "大きな画像を作成",
|
||||
"images.createImage|block": "画像を作成",
|
||||
"images|block": "画像",
|
||||
"input.acceleration|block": "加速度(ミリG)|%NAME",
|
||||
"input.onPinPressed|block": "端子 %name|がタッチされたとき",
|
||||
"input.onPinReleased|block": "端子 %NAME|がタッチされなくなったとき",
|
||||
"input.pinIsPressed|block": "端子 %NAME|がタッチされている",
|
||||
"input.rotation|block": "傾斜(°)|%NAME",
|
||||
"input.runningTime|block": "稼働時間(ミリ秒)",
|
||||
"input.setAccelerometerRange|block": "加速度センサの計測範囲を設定する %range",
|
||||
"input.temperature|block": "温度(℃)",
|
||||
"led.brightness|block": "明るさ",
|
||||
"led.enable|block": "表示をオンまたはオフにする %on",
|
||||
"led.plot|block": "点灯|x %x|y %y",
|
||||
"led|block": "LED",
|
||||
"music.setTempo|block": "テンポを設定する(bpm)|%value",
|
||||
"music.tempo|block": "テンポ(bpm)",
|
||||
"music|block": "音楽",
|
||||
"{id:category}Basic": "基本",
|
||||
"{id:category}Led": "LED",
|
||||
"{id:category}Math": "計算"
|
||||
}
|