Compare commits

..

161 Commits

Author SHA1 Message Date
0c604498d3 0.5.41 2016-10-27 13:48:27 -07:00
a8ec408f96 Merge branch 'master' of https://github.com/Microsoft/pxt-calliope 2016-10-27 13:47:58 -07:00
40fe1b4616 fix simulator support for music 2016-10-27 13:47:39 -07:00
e52da19925 0.5.40 2016-10-27 20:50:10 +02:00
d558f70118 add first pictures of calliope 2016-10-27 20:47:09 +02:00
8fca50e907 0.5.39 2016-10-27 11:31:10 -07:00
8c4abe979b Bump pxt-core to 0.5.17 2016-10-27 11:31:08 -07:00
d4fa9dab1b 0.5.38 2016-10-27 19:49:35 +02:00
955b67b6b8 rev. 0.2 sound patches 2016-10-27 19:48:42 +02:00
739be09ac9 Bumping main version to 0.5.37 with fixed icons 2016-10-25 19:53:38 +01:00
5877adc595 0.5.37 2016-10-25 18:55:41 +01:00
0380f4f0d0 Bump pxt-core to 0.5.11 2016-10-25 18:55:40 +01:00
13a4b03e9a 0.5.36 2016-10-24 23:18:56 -07:00
4b21d51769 Bump pxt-core to 0.5.9 2016-10-24 23:18:52 -07:00
e7aed1d162 fixed sounds in simulator 2016-10-24 23:17:16 -07:00
60e71e3e35 0.5.35 2016-10-24 16:39:57 -07:00
b003d89061 Bump pxt-core to 0.5.7 2016-10-24 16:39:55 -07:00
a5eb93d3e1 Updating theme.config to use the pxt theme. 2016-10-24 14:07:20 -07:00
224cb446e4 0.5.34 2016-10-24 13:51:08 -07:00
62b3d7504f Bump pxt-core to 0.5.4 2016-10-24 13:51:06 -07:00
c937cba17e merging pxt-microbit updates 2016-10-24 13:00:39 -07:00
0765159633 0.5.33 2016-10-24 20:53:32 +01:00
b14a025b14 Bump pxt-core to 0.5.3 2016-10-24 20:53:32 +01:00
74f8cc7b2e 0.5.32 2016-10-24 10:28:24 -07:00
cf778686c3 Merging microbit/master 2016-10-24 10:27:48 -07:00
99bee9e796 Merge branch 'master' of https://github.com/Microsoft/pxt-calliope 2016-10-24 10:14:43 -07:00
cb61c1a712 Bump main version to 0.5.31 with fixed icons 2016-10-24 18:01:45 +01:00
fdf3d1b66c 0.5.31 2016-10-24 17:39:33 +01:00
25ddbf9ffd Bump pxt-core to 0.5.2 2016-10-24 17:39:32 +01:00
578f971d26 Add tagged release names 2016-10-24 16:59:46 +01:00
b36ffaf29c 0.5.30 2016-10-24 16:32:56 +01:00
bff088fced Bump pxt-core to 0.5.1 2016-10-24 16:32:56 +01:00
f2c87db3ed using default analytics settings 2016-10-21 10:23:23 -07:00
8c15af11db 0.5.29 2016-10-20 20:16:52 -07:00
35e414764f missing tools 2016-10-20 20:14:25 -07:00
333659c320 0.5.28 2016-10-20 20:12:03 -07:00
8c161583eb Bump pxt-core to 0.4.71 2016-10-20 20:12:02 -07:00
b20e185bf2 parameterize download button color 2016-10-20 19:36:00 -07:00
299b595581 added custom theme style 2016-10-20 19:29:10 -07:00
65433216e6 adding semantic ui files 2016-10-20 16:40:39 -07:00
9ea2081e89 0.5.27 2016-10-20 11:48:48 -07:00
808e5fa17b Bump pxt-core to 0.4.68 2016-10-20 11:48:46 -07:00
20d967a230 removing .ico file 2016-10-20 11:30:04 -07:00
c1e5419e45 updated icons 2016-10-20 11:26:44 -07:00
27f5411404 0.5.26 2016-10-20 08:29:16 -07:00
f53eab0539 Bump pxt-core to 0.4.67 2016-10-20 08:29:11 -07:00
445fe12629 0.5.25 2016-10-19 19:11:13 +02:00
ddd6e90c6d Merge remote-tracking branch 'origin/master' 2016-10-19 19:08:52 +02:00
fd14ba6ff1 fix touch pins, add test for buttons and pins, update dependency 2016-10-19 19:08:41 +02:00
28a8f21d40 merging ble changes 2016-10-18 21:55:02 -07:00
3f626105cd 0.5.24 2016-10-18 21:07:02 -07:00
d9ff9c4800 Bump pxt-core to 0.4.65 2016-10-18 21:07:00 -07:00
31998fec05 0.5.23 2016-10-18 13:18:45 -07:00
342aa3ca32 Bump pxt-core to 0.4.63 2016-10-18 13:18:43 -07:00
9b599b6242 0.5.22 2016-10-18 16:56:58 +02:00
e5e63c548f update dal defines 2016-10-18 16:56:42 +02:00
f3eb9a988f update dependencies 2016-10-18 16:56:15 +02:00
e7e2ff7752 gesture updates 2016-10-18 16:40:53 +02:00
f10ac93268 add handling of gestures (we only have 2g, 6g ... no 3g), add mac/idea ignored files 2016-10-18 15:44:49 +02:00
47f46553e0 fix name of board 2016-10-18 15:43:52 +02:00
3158e95cde 0.5.21 2016-10-17 21:39:08 -07:00
854029fe33 updated board name 2016-10-17 21:38:58 -07:00
1b379bddd0 0.5.20 2016-10-17 21:35:07 -07:00
9495da9a53 0.5.19 2016-10-17 21:25:11 -07:00
128b3f2f51 Bump pxt-core to 0.4.62 2016-10-17 21:25:08 -07:00
a331a017b8 merged microbit changes 2016-10-17 13:36:54 -07:00
5cce86ec7e 0.5.18 2016-10-17 10:54:19 -07:00
65e01dc0df Bump pxt-core to 0.4.59 2016-10-17 10:54:17 -07:00
7aeb216462 0.5.17 2016-10-16 20:26:19 -07:00
543659b0e8 specifying pin positions 2016-10-16 20:25:55 -07:00
a2b5ff68af 0.5.16 2016-10-16 20:09:30 -07:00
b968d3b1de fixing simulator in IE11 2016-10-16 20:09:13 -07:00
4dbebe3e15 fixing logo in IE11 2016-10-16 09:28:30 -07:00
3b95fede48 optimizing logo 2016-10-16 09:19:40 -07:00
971faed80a 0.5.15 2016-10-14 21:56:38 -07:00
02a58caf7a Bump pxt-core to 0.4.58 2016-10-14 21:56:37 -07:00
912e2e6159 enabling inverted menu 2016-10-14 11:32:00 -07:00
e834ae0656 0.5.14 2016-10-14 08:04:04 -07:00
175923fcb9 updated logos 2016-10-14 08:00:34 -07:00
42ebdde3df 0.5.13 2016-10-14 07:48:36 -07:00
20c63359af hiding microsoft logo 2016-10-14 07:48:23 -07:00
841f3dc7d6 0.5.12 2016-10-14 07:35:12 -07:00
f7377f6a21 Bump pxt-core to 0.4.57 2016-10-14 07:35:09 -07:00
1104ab5b33 updated logos 2016-10-14 07:21:50 -07:00
e2fe660012 towards pin placement 2016-10-14 06:46:56 -07:00
7d4b800637 identifying and naming pins 2016-10-13 23:53:24 -07:00
746728759d setting default locale to German 2016-10-13 10:21:56 -07:00
3d3b9e2718 Bump pxt-core to 0.4.56 2016-10-13 10:06:10 -07:00
0459cd693d 0.5.11 2016-10-13 16:58:33 +02:00
9c43714126 fix dependency 2016-10-13 16:58:14 +02:00
9bf7459628 0.5.10 2016-10-13 16:30:38 +02:00
b52432e103 update dependency 2016-10-13 16:26:30 +02:00
3ac0a060dd added pin mapping 2016-10-13 11:16:10 +02:00
85ebbb28e3 0.5.9 2016-10-12 23:52:47 -07:00
f69db3faf7 Bump pxt-core to 0.4.55 2016-10-12 23:52:45 -07:00
4fc514e643 updated screen rendering 2016-10-12 23:40:33 -07:00
7c2512e56b fixing thermometer 2016-10-12 23:30:19 -07:00
d9eebf4a9f support for light level / thermometer simulation 2016-10-12 23:14:38 -07:00
8af383ec56 updated svg layout 2016-10-12 22:44:05 -07:00
573d7aff40 add svg with pins and connectors id-ed 2016-10-12 23:07:55 +02:00
f73274803c 0.5.8 2016-10-12 18:57:05 +02:00
63556ef14a update dependency 2016-10-12 18:56:51 +02:00
9607183587 0.5.7 2016-10-12 18:02:23 +02:00
4cca961e52 latest version with RGB led support 2016-10-12 18:02:16 +02:00
c2a1668d55 Merge remote-tracking branch 'origin/master' 2016-10-12 17:54:39 +02:00
7102eddc0b add color handling for LED 2016-10-12 17:54:25 +02:00
b34884fe00 updated readme 2016-10-12 08:13:15 -07:00
e768a4dc97 updated links 2016-10-12 08:11:05 -07:00
8b1b1bb869 0.5.6 2016-10-12 04:50:08 -07:00
57deb1749f Bump pxt-core to 0.4.54 2016-10-12 04:50:06 -07:00
fb82b94f69 0.5.5 2016-10-12 04:03:19 -07:00
d321170da9 Bump pxt-core to 0.4.53 2016-10-12 04:03:17 -07:00
dff4f3adb3 basic motor block support 2016-10-11 22:58:53 -07:00
5d8a1b69f6 0.5.4 2016-10-11 19:42:10 -07:00
0b0c2c9466 merged latest pxt 2016-10-11 19:41:59 -07:00
9319f10430 0.5.3 2016-10-11 11:43:38 -07:00
c4787e1028 support for rgb led in simulator 2016-10-11 11:41:51 -07:00
cb280af783 fix json in libs/hello 2016-10-11 10:13:30 -07:00
4201cb3070 0.5.2 2016-10-11 09:34:26 -07:00
ec7bade8f4 missed file in previous move 2016-10-11 09:21:24 -07:00
d738d8bbf5 0.5.1 2016-10-11 09:14:47 -07:00
a8b1e0bc04 bumping version number 2016-10-11 09:14:32 -07:00
114b7958bc 0.4.32 2016-10-11 09:13:05 -07:00
f45ae5950c 0.4.31 2016-10-11 09:09:25 -07:00
4cdfaf06c0 0.4.30 2016-10-11 09:08:41 -07:00
d48404eb37 integrated pxt-microbit 2016-10-11 09:08:31 -07:00
f4ac599ec2 Bump pxt-core to 0.4.51 2016-10-11 09:05:10 -07:00
a783cdda92 0.4.29 2016-10-11 13:33:35 +02:00
5900c8c9f5 update dependency 2016-10-11 13:32:42 +02:00
3911c6522d integrate pxt-microbit changes 2016-10-10 14:43:33 -07:00
00cdb6f9f5 0.4.28 2016-10-10 13:35:54 -07:00
df14445320 updated travis file 2016-10-10 13:34:24 -07:00
553b692a9a 0.4.27 2016-10-10 13:19:17 -07:00
7f2fd0dd09 positioning systemled 2016-10-10 13:16:39 -07:00
ae6917c7b3 0.4.26 2016-10-10 13:03:20 -07:00
5c1d9a342b updated to core v0.5.4 2016-10-10 13:03:08 -07:00
d41724d239 0.4.25 2016-10-10 12:58:42 -07:00
d6a006d18f Bump pxt-core to 0.4.48 2016-10-10 11:25:24 -07:00
cace68acf4 updated hello sample 2016-10-10 11:20:25 -07:00
68ef7c2fc2 fix initialization of Accelerometer (delayed in uBit.init()), enable DAL debugging 2016-10-08 15:15:01 +02:00
4c502f0825 bump pxt-calliope-core dependency 2016-10-08 12:23:29 +02:00
a2f1cef9ae Merge branch 'master' of github.com:Microsoft/pxt-calliope 2016-10-07 11:39:31 -07:00
e857a94e04 0.4.24 2016-10-07 18:48:34 +02:00
42a93a1682 updated accent color 2016-10-03 18:54:07 -07:00
e983c76e2f Remove unneeded tests 2016-10-03 11:15:49 -07:00
ced4565d5c 0.4.23 2016-10-01 15:52:41 -07:00
2475058b94 0.4.22 2016-10-01 15:45:43 -07:00
c6ee0db81c Bump pxt-core to 0.4.39 2016-10-01 15:45:41 -07:00
1b96e6332a 0.4.21 2016-10-01 21:02:36 +02:00
1ceec1d3b4 0.4.20 2016-10-01 20:59:44 +02:00
2e9ddb48df 0.4.19 2016-10-01 20:58:45 +02:00
2296220ad7 updated logos 2016-09-29 16:23:37 -07:00
22864bd26a pointing to cloud compile service 2016-09-29 16:13:33 -07:00
574a9e01d5 updating pinmap 2016-09-29 15:25:57 -07:00
00278036a4 fixing pin mapping 2016-09-29 15:20:45 -07:00
4b583e221b limited support for RGB led 2016-09-27 13:35:48 -07:00
c88645d0cd support for AB / Shake buttons 2016-09-27 11:00:21 -07:00
14e8eabd25 updated simulator ratio, domain names 2016-09-27 09:35:52 -07:00
5fab789763 merging microbit 2016-09-26 22:00:04 -07:00
33eca3c507 tweaked colors 2016-09-26 15:10:37 -07:00
9ccfcf19d9 initial round of visual updates 2016-09-26 15:05:06 -07:00
715 changed files with 7488 additions and 35153 deletions

6
.gitignore vendored
View File

@ -15,7 +15,7 @@ clients/win10/app/bld
clients/win10/*.opendb
clients/**/bin/**
clients/**/obj/**
electron-out
clients/electron/projects
hexcache
*.user
@ -25,5 +25,9 @@ hexcache
*.db
*.suo
*.log
.DS_Store
.idea
*.iml
.vscode/.BROWSE.VC.DB-shm
.vscode/.BROWSE.VC.DB-wal

View File

@ -3,16 +3,12 @@ node_js:
- "5.7.0"
script:
- "node node_modules/pxt-core/built/pxt.js travis"
- "(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js run)"
- "(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js run)"
- "(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js test)"
- "(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js test)"
- "node node_modules/pxt-core/built/pxt.js testdir tests"
- "(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv https://az851932.vo.msecnd.net/files/td-converter-tests-v1.json)"
- "node node_modules/pxt-core/built/pxt.js uploaddoc"
sudo: false
notifications:
email:
- touchdevelop-build@microsoft.com
- kindscript@microsoft.com
cache:
directories:
- node_modules

View File

@ -1,6 +1,6 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.autoSave": "afterDelay",
"file.autoSave": "afterDelay",
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/built/**": true,

View File

@ -1,26 +0,0 @@
# 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

View File

@ -1,25 +0,0 @@
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.

View File

@ -1,15 +1,11 @@
# micro:bit target for PXT
# Calliope target for PXT
This target allow to program a [BBC micro:bit](https://www.microbit.co.uk/) using
This target allow to program a [Calliope](http://calliope.cc/) using
PXT ([Microsoft Programming Experience Toolkit](https://github.com/Microsoft/pxt)).
* [Try it live](https://pxt.microbit.org)
[![Build Status](https://travis-ci.org/Microsoft/pxt-calliope.svg?branch=master)](https://travis-ci.org/Microsoft/pxt-calliope)
[![Build Status](https://travis-ci.org/Microsoft/pxt-microbit.svg?branch=master)](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!
![](http://calliope.cc/content/1-ueber-mini/mini_board.png)
## Local server
@ -19,11 +15,11 @@ The local server allows to run the editor and the documentation from your comput
The following commands are a 1-time setup after synching the repo on your machine.
* See requirements for [pxt](https://github.com/Microsoft/pxt)
* if not yet installed, install [Node.js 4.4.5 or higher](https://nodejs.org/en/download/)
* [clone this repo](https://help.github.com/articles/cloning-a-repository/) to your computer and go in the project folder
```
git clone https://github.com/microsoft/pxt-microbit
cd pxt-microbit
git clone https://github.com/microsoft/pxt-calliope
cd pxt-calliope
```
* install the PXT command line (add ``sudo`` for Mac/Linux shells).
```
@ -36,14 +32,15 @@ npm install
### Running
Run this command to open a local web server (add ``sudo`` for Mac/Linux shells)
Run this command to open a local web server (add ``sudo`` for Mac/Linux shells).
```
pxt serve
```
If the local server opens in the wrong browser, make sure to copy the URL containing the local token.
Otherwise, the editor will not be able to load the projects.
If you need modify the `.cpp` files, turn on yotta compilation with the ``-yt`` flag (add ``sudo`` for Mac/Linux shells):
If you need modify the `.cpp` files, turn on yotta compilation with the ``-yt`` flag (add ``sudo`` for Mac/Linux shells). On Windows, you must be running
from the ``Run Yotta`` command prompt.
```
pxt serve -yt
```
@ -65,7 +62,6 @@ The build automatically runs the following:
* `pxt run` in `libs/lang-test*` - this will run the test in command line runner;
there is a number of asserts in both of these
* `pxt testdir` in `tests` - this makes sure all the files compile and generates .hex files
* run the TD->TS converter on a number of test scripts from `microbit.co.uk` and make sure the results compile
To test something on the device:

View File

@ -1,43 +0,0 @@
/*!----------------- PXT ThirdPartyNotices -------------------------------------------------------
PXT uses third party material from the projects listed below.
The original copyright notice and the license under which Microsoft
received such third party material are set forth below. Microsoft
reserves all other rights not expressly granted, whether by
implication, estoppel or otherwise.
In the event that we accidentally failed to list a required notice, please
bring it to our attention. Post an issue or email us:
abchatra@microsoft.com
---------------------------------------------
Third Party Code Components
---------------------------------------------
Some code derived (as noted) from
https://github.com/bbcmicrobit/micropython
The MIT License (MIT)
Copyright (c) 2013-2016 The MicroPython-on-micro:bit Developers, as listed
in the accompanying AUTHORS file
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.

View File

@ -1,5 +1,5 @@
# microbit-chrome
Prototype chrome addon that exposes the @boardname@'s serial output to webpages.
Prototype chrome addon that exposes the micro:bit's serial output to webpages.
* watch the [demo video](https://vimeo.com/146207766)
# Installation

View File

@ -1,3 +1,4 @@
///<reference path='typings/browser.d.ts'/>
var connections = [];
// A list of "ports", i.e. connected clients (such as web pages). Multiple web
// pages can connect to our service: they all receive the same data.
@ -40,7 +41,7 @@ function findNewDevices() {
function main() {
// Register new clients in the [ports] global variable.
chrome.runtime.onConnectExternal.addListener(function (port) {
if (/^(micro:bit|touchdevelop|yelm|pxt|codemicrobit|codethemicrobit|pxt.microbit.org)$/.test(port.name)) {
if (/^(micro:bit|touchdevelop|yelm|pxt|codemicrobit|codethemicrobit)$/.test(port.name)) {
ports.push(port);
port.onDisconnect.addListener(function () {
ports = ports.filter(function (x) { return x != port; });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -6,10 +6,10 @@
},
"manifest_version": 2,
"name": "pxt.microbit.org",
"version": "0.7.0",
"name": "code the micro:bit",
"version": "0.6.0",
"author": "Microsoft Corporation",
"short_name": "pxt.microbit.org",
"short_name": "code the micro:bit",
"description": "Extension for https://pxt.microbit.org.",
"homepage_url": "https://pxt.microbit.org",

2
clients/electron/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
projects

View File

@ -0,0 +1,5 @@
# 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`.

View File

@ -0,0 +1,15 @@
<!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>

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

@ -0,0 +1,39 @@
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()
}
})

View File

@ -0,0 +1,14 @@
{
"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 Normal file
View File

@ -0,0 +1,59 @@
/// <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([])
}
}

View File

@ -1,7 +0,0 @@
/// <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"), "..", "..");

16
docfiles/appmeta.html Normal file
View File

@ -0,0 +1,16 @@
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@codethemicrobit" />
<meta name="twitter:title" content="code the micro:bit" />
<meta name="twitter:description" content="Blocks+JavaScript for programming your micro:bit" />
<meta name="twitter:image" content="https://az851932.vo.msecnd.net/pub/drbwxcth" />
<meta property="og:title" content="micro:bit editor" />
<meta property="og:description" content="Blocks+JavaScript for programming your micro:bit" />
<meta property="og:site_name" content="code the micro:bit" />
<meta property="og:image" content="https://az851932.vo.msecnd.net/pub/drbwxcth" />
<!--
Canonical URL needs to wait until main release is updated.
<meta property="og:url" content="https://codethemicrobit.com" />
<meta property="og:type" content="website" />
<meta property="fb:app_id" content="" />
-->

21
docfiles/meta.html Normal file
View File

@ -0,0 +1,21 @@
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@codethemicrobit" />
<meta name="twitter:title" content="@name@" />
<meta name="twitter:description" content="@description@" />
<meta name="twitter:image" content="@cardLogo@" />
<meta property="og:title" content="@name@" />
<meta property="og:site_name" content="code the micro:bit" />
<meta property="og:description" content="@description@" />
<meta property="og:image" content="@cardLogo@" />
<!--
<meta property="og:type" content="website" />
<meta property="fb:app_id" content="" />
-->
<link rel="apple-touch-icon" href="@appLogo@">
<link rel="icon" type="image/png" href="@appLogo@">
<link rel="mask-icon" href="https://az851932.vo.msecnd.net/pub/zwxazere/safari-pinned-tab.svg" color="#000000">
<link rel="shortcut icon" href="@appLogo@">
<meta name="theme-color" content="@accentColor@">

5
docfiles/target.css Normal file
View File

@ -0,0 +1,5 @@
#root .avatar .avatar-image {
background-image: url(https://az851932.vo.msecnd.net/pub/jovrytni/microbit.simplified.svg);
background-size: contain;
background-repeat: no-repeat;
}

View File

@ -0,0 +1,22 @@
{
"name": "koduj z micro:bit",
"title": "koduj z micro:bit",
"docMenu": [
{
"name": "O nas",
"path": "/about"
},
{
"name": "Lekcje",
"path": "/lessons"
},
{
"name": "Instrukcja obsługi",
"path": "/reference"
},
{
"name": "Urządzenie",
"path": "/device"
}
]
}

7
docs/_locales/pl/docs.md Normal file
View File

@ -0,0 +1,7 @@
# Dokumentacja
Witamy na stronach dokumentacji!
* Przeglądnij [instrukcje obsługi](/reference)
* Dowiedz się więcej o [urządzeniu](/device)
* Wystartuj z [lekcjami](/lessons)

View File

@ -1,10 +1,6 @@
# Blocks language
### @description Language constructs for the Block editor.
Blocks snap into each other to define the program that your @boardname@ will run.
Blocks can be event (buttons, shake, ...) or need to be snapped into an event to run.
The [on-start](/blocks/on-start) event runs first.
### @description Langugage constructs for the Block editor.
```namespaces
for (let i = 0;i<5;++i) {}
@ -15,4 +11,4 @@ Math.random(5);
## See Also
[logic](/blocks/logic), [loops](/blocks/loops), [math](/blocks/math), [variables](/blocks/variables), [on-start](/blocks/on-start)
[logic](/blocks/logic), [loops](/blocks/loops), [math](/blocks/math), [variables](/blocks/variables)

View File

@ -86,14 +86,12 @@ 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
input.onButtonPressed(Button.A, () => {
let x = Math.random(5)
if(x < 5) {
basic.showString("low");
} else {
basic.showString("high");
}
})
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.

View File

@ -14,16 +14,14 @@ Click on the dark blue gear icon (see above) to add an *else* or *if* to the cur
### Example: adjusting screen brightness
If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255` when the button A is pressed:
```blocks
input.onButtonPressed(Button.A, () => {
if(input.lightLevel()<100){
led.setBrightness(255);
}
})
if(input.lightLevel()<100){
led.setBrightness(255);
}
```
If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255`:
### See also
[while loop](/blocks/loops/while), [for](/blocks/loops/for), [boolean](/blocks/logic/boolean)

View File

@ -4,21 +4,14 @@
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
input.onButtonPressed(Button.A, () => {
for(let i = 0; i < 5; ++i) {
basic.showNumber(i)
}
})
for(let i = 0; i < 5; ++i) {
basic.showNumber(i)
}
```
### See also

View File

@ -2,7 +2,7 @@
Repeat code while a [Boolean](/blocks/logic/boolean) `condition` is true.
```block
```blocks
while(true) {
}
```
@ -16,13 +16,11 @@ 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
input.onButtonPressed(Button.A, () => {
let index = 4;
while(index >= 0) {
led.plot(index, index);
index--;
}
})
let index = 4;
while(index >= 0) {
led.plot(index, index);
index--;
}
```
### See also

View File

@ -1,28 +0,0 @@
# 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.
## Hey, my events moved!
When we transform the blocks into JavaScript, we always place all the event registrations (buttons, shake, ...)
before launching the ``on start`` code.
If a block from ``on start`` pauses, other registered events will have the opportunity to run as well.

View File

@ -1,6 +1,7 @@
# Unsupported configuration
Your browser is currently not supported. The following configurations are supported:
[pxt.microbit.org](https://pxt.microbit.org) doesn't currently support
your browser or operating system. The following configurations are supported:
## Windows

View File

@ -91,10 +91,3 @@ basic.showString("d", 150)
You will not see the LED at position `0,0` lit up because the `show string` function overwrites the whole display buffer.
### Pins: P3, P4, P6, P7, P9, P10
These pins are coupled to the LED matrix display, and also its associated ambient light sensing mode.
To disable the display driver feature (which will automatically disable the light sensing feature) use the function [led.enable](/reference/led/enable).
More information at http://tech.microbit.org/hardware/edgeconnector_ds/ .

View File

@ -1,116 +0,0 @@
# Equipping a microservo with Crocodile clips
## 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.
![](/static/mb/projects/inchworm/servo1.jpg)
## Step 2: strip out cables
Using the plier or a wire stripper, strip the plastic from the cables.
![](/static/mb/projects/inchworm/servotrim.jpg)
## Step 3: threading the servo cablers
Thread the servo cables.
![](/static/mb/projects/inchworm/servo3.jpg)
## 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!
![](/static/mb/projects/inchworm/servo4.jpg)
## Step 5: thread cables together
Place the cables next to each other
![](/static/mb/projects/inchworm/servo5.jpg)
... and thread them together.
![](/static/mb/projects/inchworm/servo6.jpg)
### ~ 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 solder this connection.**
### ~
## Step 4: protect the connection
Protect the connection with electrical or duct tape.
![](/static/mb/projects/inchworm/servo7.jpg)
## Step 5: repeat for all cables
Repeat the same process until all cables are connected.
![](/static/mb/projects/inchworm/servo8.jpg)
## 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``.
![](/static/mb/projects/inchworm/circuit1.jpg)
### ~ hint
When attaching the crocodile clips to the pins, don't hesitate to grab the side of the board with the jaws.
![](/static/mb/projects/inchworm/circuit2.jpg)
### ~
* Download the following code to your @boardname@
```blocks
basic.forever(() => {
pins.servoWritePin(AnalogPin.P0, pins.map(
input.acceleration(Dimension.X),
-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.
## Troubleshooting
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.

View File

@ -8,10 +8,10 @@
* [Projects](/projects)
* [Lessons](/lessons)
### @boardname@ reference
### Micro:bit reference
* [The @boardname@ APIs](/reference)
* [The @boardname@ device](/device)
* [The micro:bit APIs](/reference)
* [The micro:bit device](/device)
### Language and data reference
@ -28,4 +28,4 @@
* [Command Line Interface](/cli)
* Learn about [packages](/packages)
* [Release notes](/release-notes)

View File

@ -2,13 +2,4 @@
### @description Frequently asked questions and answers from our users.
## Which web sites do I need to unblock for pxt.microbit.org?
This is the list of domains that need to be unblocked to allow the web editor to load:
* https://pxt.microbit.org
* https://www.pxt.io
* https://trg-microbit.userpxt.io
* https://pxt.azureedge.net
Can't find your question? Please search for solutions or open a ticket at [support.microbit.org](https://support.microbit.org)!
Please search for solutions or open a ticket at [support.microbit.org](https://support.microbit.org)!

View File

@ -1,6 +1,6 @@
# Getting started
### @description An activity for beginners to get started with the @boardname@
### @description An activity for beginners to get started with the micro:bit
## ~avatar
@ -33,9 +33,9 @@ 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
`[basic.forever(() => {})]` block.)
``forever`` block.)
Click **Download** to move your program to the @boardname@!
Click **Download** to move your program to the BBC micro:bit!
Make sure to follow the instructions.
### ~button /getting-started/screen

View File

@ -17,12 +17,12 @@ input.onButtonPressed(Button.A, () => {
#### ~hint
The `[basic.showString("HI")]` block can show letters, numbers, and punctuation
on the @boardname@ screen.
The ``showString`` block can show letters, numbers, and punctuation
on the micro:bit screen.
#### ~
Now try to unscramble these blocks in the editor so that the @boardname@
Now try to unscramble these blocks in the editor so that the micro:bit
shows **BANANA** when you press button `B`.
```shuffle
@ -33,11 +33,11 @@ input.onButtonPressed(Button.B, () => {
#### ~hint
You can find the letter `B` by clicking the letter `A` on the
`[input.onButtonPressed(Button.A, () => {})]` block.
``onButtonPressed`` block.
#### ~
Click **Download** to move your program to the @boardname@!
Click **Download** to move your program to the BBC micro:bit!
#### Your turn!
@ -48,9 +48,9 @@ name_ instead of **BANANA** when you press `B`?
### Pins
You can also use the pins as buttons. (The pins are the holes in the
metal stripe at the bottom of the @boardname@ board.) For example, hold
metal stripe at the bottom of the micro:bit board.) For example, hold
the ``GND`` button with one hand and touch the ``0`` pin (called
``P0``) with your other hand to tell the @boardname@ you're pressing it.
``P0``) with your other hand to tell the micro:bit you're pressing it.
Unscramble the blocks in the editor to show a heart when you touch
pin ``P0``.
@ -65,7 +65,7 @@ input.onPinPressed(TouchPin.P0, () => {
. . # . .`);
});
```
Click **Download** to move your program to the @boardname@!
Click **Download** to move your program to the BBC micro:bit!
## ~hint

View File

@ -4,7 +4,7 @@
Are you trying to choose whether to play soccer or go to the movies
instead, or which toppings to have on your pizza? Build a coin
flipping machine with the @boardname@ to choose for you!
flipping machine with the BBC micro:bit to choose for you!
### ~
@ -23,8 +23,8 @@ input.onButtonPressed(Button.B, () => {
```
### ~hint
The `[Math.randomBoolean()]` block randomly tells the ``if``
block `true` or `false`. If value picked is `true`, the
The ``pick random true or false`` block randomly tells the ``if``
block `true` or `false`. If the ``pick`` block picked `true`, the
``if`` block shows the letter `H`. Otherwise, it shows the letter `T`.
That's it!
@ -50,7 +50,7 @@ input.onButtonPressed(Button.AB, () => {
```
These blocks mean that if you press button `A`, you will add `1` to
your score, and if you press `A` and `B` together, the @boardname@ will
your score, and if you press `A` and `B` together, the micro:bit will
show your score.
When you're done, your coin flipping program should look like this:

View File

@ -2,8 +2,8 @@
### ~avatar avatar
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
Build a Rock Paper Scissors game with the BBC micro:bit! You can play
the game with a friend who has it on a micro:bit. You can also play
it with friends who are just using their hands. (The game is built
like a coin flipper, but with three choices instead of two.)
@ -11,9 +11,9 @@ like a coin flipper, but with three choices instead of two.)
## Step 1: Getting started
We want the @boardname@ to choose rock, paper, or scissors when you
We want the micro:bit to choose rock, paper, or scissors when you
shake it. Try creating an ``on shake`` block so when you shake the
@boardname@, it will run part of a program.
micro:bit, it will run part of a program.
Clear up the blocks and add the blocks below.
@ -23,7 +23,7 @@ input.onGesture(Gesture.Shake, () => {
})
```
Next, when you shake the @boardname@, it should pick a random number from `0` to `2`
Next, when you shake the micro:bit, it should pick a random number from `0` to `2`
and store it in the variable `item`.
Add a ``set`` block with a variable. Then add a ``pick random`` block,
@ -75,7 +75,7 @@ input.onGesture(Gesture.Shake, () => {
## Step 3: A random rock
Now we are going to add a new picture for the @boardname@ to show
Now we are going to add a new picture for the micro:bit to show
when another random number comes up.
Make the ``else if`` part check if the variable `item` is `1`.
@ -152,7 +152,7 @@ That's why you can use an ``else`` instead of an ``else if``.
Your game is ready!
Click **Download** to move your program to the @boardname@!
Click **Download** to move your program to the BBC micro:bit!
Have fun!
@ -160,7 +160,7 @@ Have fun!
Here is a way you can make your Rock Paper Scissors game better.
When button ``A`` is pressed,
the @boardname@ will add `1` to your score.
the micro:bit will add `1` to your score.
Open the ``Game`` drawer, and then add the block ``change score by 1`` to your program,
like this:
@ -174,7 +174,7 @@ input.onButtonPressed(Button.A, () => {
## Step 6: Prove you're the greatest!
After your @boardname@ can add `1` to the score, show how many wins you have.
After your micro:bit can add `1` to the score, show how many wins you have.
```blocks
input.onButtonPressed(Button.A, () => {
@ -185,7 +185,7 @@ input.onButtonPressed(Button.A, () => {
```
## Step 7: Staying honest
Success! Your @boardname@ can track wins!
Success! Your micro:bit can track wins!
But what about losses?
Use the ``Game`` drawer to subtract `1` from your score when you press button `B`.
@ -198,7 +198,7 @@ input.onButtonPressed(Button.B, () => {
basic.showNumber(game.score())
})
```
Click **Download** to move your program to the @boardname@!
Click **Download** to move your program to the BBC micro:bit!
### ~button /projects
NEXT: PROJECTS!

View File

@ -2,17 +2,17 @@
### ~avatar avatar
There are 25 bright LEDs on the @boardname@ screen. Let's use them to create some cool animations!
There are 25 bright LEDs on the micro:bit screen. Let's use them to create some cool animations!
### ~
### Happy unhappy face
Draw an unhappy face instead of the blank screen. Click on the dots
in the second `[basic.showLeds("")]` block until it matches the blocks below.
in the second ``show leds`` 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@)!
you turn off your micro:bit)!
```blocks
basic.forever(() => {
@ -32,11 +32,11 @@ basic.forever(() => {
`)
});
```
Click **Download** to move your program to the @boardname@!
Click **Download** to move your program to the BBC micro:bit!
### Your turn!
Pile up more `[basic.showLeds("")]` blocks to create an animation! Create an
Pile up more ``show leds`` blocks to create an animation! Create an
animation with at least 5 pictures. What does this animation show?
```blocks
@ -85,7 +85,13 @@ basic.forever(() => {
`)
});
```
Click **Download** to move your program to the @boardname@!
Click **Download** to move your program to the BBC micro:bit!
#### ~hint
You can find the ``show leds`` block in the **Basic** part of the editor.
#### ~
### ~button /getting-started/buttons
NEXT: BUTTONS

View File

@ -1,11 +1,11 @@
# Shake
You can find when someone is shaking the @boardname@ by checking its
**accelerometer** (it finds whether the @boardname@ is speeding up or
You can find when someone is shaking the BBC micro:bit by checking its
**accelerometer** (it finds whether the micro:bit is speeding up or
slowing down).
Unscramble these blocks in the editor to show a frownie when someone
shakes the @boardname@. (Ouch!)
shakes the micro:bit. (Ouch!)
```shuffle
input.onGesture(Gesture.Shake, () => {
@ -17,7 +17,7 @@ input.onGesture(Gesture.Shake, () => {
# . . . #`);
});
```
Click **Download** to move your program to the @boardname@!
Click **Download** to move your program to the BBC micro:bit!
### ~button /getting-started/coin-flipper
NEXT: COIN FLIPPER GAME

View File

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

View File

@ -1,7 +1,6 @@
# JavaScript
Visit the cards below to starting programming JavaScript
with the @boardname@:
Visit the cards below to starting programming JavaScript and TypeScript with the micro:bit:
```codecard
[{

View File

@ -1,8 +1,8 @@
# Call a function
The simplest way to get started in JavaScript with your @boardname@ is to
call one of the @boardname@'s built-in JavaScript functions. Just like Blocks
are organized into categories/drawers, the @boardname@ functions are organized by
The simplest way to get started in JavaScript with your micro:bit is to
call one of the micro:bit's built-in JavaScript functions. Just like Blocks
are organized into categories/drawers, the micro:bit functions are organized by
namespaces, with names corresponding to the drawer names. The `basic` namespace
contains a number of helpful functions, such as:

View File

@ -35,7 +35,7 @@ This calls into the constructor we defined earlier, creating a new object with t
# Inheritance
### ~hint
### Inheritance is not supported yet for the @boardname@. Coming soon...
### Inheritance is not supported yet for the micro:bit. Coming soon...
### ~
In TypeScript, we can use common object-oriented patterns.

View File

@ -1,8 +1,8 @@
# Frequently asked questions
# What is the language supported for the @boardname@?
# What is the language supported for the micro:bit?
For the @boardname@, we support a "static" subset of TypeScript (itself a superset of JavaScript):
For the micro:bit, we support a "static" subset of TypeScript (itself a superset of JavaScript):
## Supported language features

View File

@ -13,7 +13,7 @@ basic.showNumber(add(1, 2))
```
### ~ hint
For the @boardname@, you must specify a [type](/js/types) for each function parameter.
For the micro:bit, you must specify a [type](/js/types) for each function parameter.
### ~
Functions can refer to variables outside of the function body.

View File

@ -1,9 +1,9 @@
## Operators
The following JavaScript operators are supported for the @boardname@.
The following JavaScript operators are supported for the micro:bit.
### ~hint
Note that for the @boardname@ all arithmetic is performed on integers, rather than floating point.
Note that for the micro:bit all arithmetic is performed on integers, rather than floating point.
This also is true when simulating in the browser.
### ~

View File

@ -48,7 +48,7 @@ basic.showNumber(1);
### ~hint
For the @boardname@, we don't allow a program to contain an empty statement, such as shown above.
For the micro:bit, we don't allow a program to contain an empty statement, such as shown above.
If you really want an empty statement, you need to use curly braces to delimit an empty statement block:
```typescript
while(true) { }

View File

@ -1,6 +1,6 @@
# Statements
The following JavaScript statements are supported for the @boardname@:
The following JavaScript statements are supported for the micro:bit:
## Variable declarations
* `const` statement - [read more](http://devdocs.io/javascript/statements/const)

View File

@ -15,7 +15,7 @@ let isDone: boolean = false;
### ~ hint
In JavaScript, `numbers` are floating point values.
However, for the @boardname@, `numbers` are integer values.
However, for the micro:bit, `numbers` are integer values.
### ~
Integer values can be specified via decimal, hexadecimal and octal notation:
@ -74,7 +74,7 @@ let list: Array<number> = [1, 2, 3];
```
### ~hint
For the @boardname@, all elements of an array must have the same type.
For the micro:bit, all elements of an array must have the same type.
### ~
@ -106,7 +106,7 @@ let c: Color = Color.Green;
# Any
The TypeScript type `any` is not supported in the @boardname@.
The TypeScript type `any` is not supported in the micro:bit.
# Void

View File

@ -28,7 +28,7 @@
## Intermediate
* [Magic 8](/lessons/magic-8), a fortune teller game with the @boardname@
* [Magic 8](/lessons/magic-8), a fortune teller game with the BBC micro:bit
* [Guess the Number](/lessons/guess-the-number), guess a random number with pick number
* [Counter](/lessons/counter), display a number with a variable
* [Love Meter](/lessons/love-meter), create a love meter with on pin pressed
@ -40,7 +40,7 @@
* [Temperature](/lessons/temperature), get the ambient temperature (degree Celsius °C)
* [Digi Yoyo](/lessons/digi-yoyo), create a counter with a while loop
* [Rotation Animation](/lessons/rotation-animation), control an animation with a boolean variable
* [Compass](/lessons/compass), displays the direction the @boardname@ is pointing with compass
* [Compass](/lessons/compass), displays the direction the BBC micro:bit is pointing with compass
* [Zoomer](/lessons/zoomer), measure the force with acceleration
* [Glowing Pendulum](/lessons/glowing-pendulum), construct a pendulum that glows using acceleration
* [Classic Beatbox](/lessons/classic-beatbox), make a beatbox music player with variables
@ -60,7 +60,7 @@
* [Prank WiFi](/lessons/prank-wifi), create fake WiFi to trick your friends
* [Speed Button](/lessons/speed-button), code a speed game with running time
* [Headbands](/lessons/headbands), create a charades game with a collection of strings that hold the words
* [Hero](/lessons/hero), reconstruct the classic arcade game pac man with the @boardname@
* [Hero](/lessons/hero), reconstruct the classic arcade game pac man with the BBC micro:bit
* [Catch the Egg](/lessons/catch-the-egg-game), catch falling eggs in a basket with an acceleration controller
### ~

View File

@ -1,6 +1,6 @@
# answering machine blocks lesson
Create an answering machine on the @boardname@
Create an answering machine on the BBC micro:bit
## Topic

View File

@ -1,6 +1,6 @@
# answering machine blocks activity
Learn to create an answering machine on the @boardname@
Learn to create an answering machine on the micro:bit
### ~avatar avatar

View File

@ -12,7 +12,7 @@ basic.showString("ASK ME A QUESTION")
### Challenge 1
Now we need to reply after someone asks @boardname@ a yes or no question. We want to respond `YES` when button `A` is pressed. Add a condition for button `A` and inside it show the string `YES`.
Now we need to reply after someone asks micro:bit a yes or no question. We want to respond `YES` when button `A` is pressed. Add a condition for button `A` and inside it show the string `YES`.
```blocks
basic.showString("ASK ME A QUESTION")
@ -25,7 +25,7 @@ input.onButtonPressed(Button.A, () => {
### Challenge 2
What if @boardname@'s answer to the question is no? Let's have `NO` be displayed when button `B` is pressed. Add a condition for button `B` and inside it show the string `NO`.
What if micro:bit's answer to the question is no? Let's have `NO` be displayed when button `B` is pressed. Add a condition for button `B` and inside it show the string `NO`.
```blocks
basic.showString("ASK ME A QUESTION")

View File

@ -1,6 +1,6 @@
# answering machine blocks quiz answers
Create an answering machine on the @boardname@.
Create an answering machine on the micro:bit.
This is the answer key for the [answering machine quiz](/lessons/answering-machine/quiz).
@ -26,7 +26,7 @@ basic.showString("Hi")
![](/static/mb/lessons/answering-machine-1.png)
## 4. If the rectangle below represents the @boardname@, write the code to display the letter "Z".
## 4. If the rectangle below represents the micro:bit, write the code to display the letter "Z".
![](/static/mb/lessons/answering-machine-2.png)

View File

@ -1,6 +1,6 @@
# answering machine blocks quiz
Create an answering machine on the @boardname@.
Create an answering machine on the micro:bit.
## Name
@ -36,7 +36,7 @@ basic.showString("Hi")
![](/static/mb/lessons/answering-machine-4.png)
## 4. If the rectangle below represents the @boardname@, write the code to display the letter "Z".
## 4. If the rectangle below represents the micro:bit, write the code to display the letter "Z".
```blocks
basic.showString("Z")

View File

@ -1,6 +1,6 @@
# beautiful image lesson
Display beautiful images on the @boardname@.
Display beautiful images on the BBC micro:bit.
## Topic
@ -14,7 +14,7 @@ Show LEDs
## Prior learning/place of lesson in scheme of work
Learn how to **show LEDs**, to show an image on the @boardname@'s LED screen. We will be learning how to Show LEDs using simple commands such as Show LEDs and pause.
Learn how to **show LEDs**, to show an image on the BBC micro:bit's LED screen. We will be learning how to Show LEDs using simple commands such as Show LEDs and pause.
## Documentation
@ -31,6 +31,6 @@ basic.pause(100)
## Objectives
* learn how to display an image on the @boardname@'s LED screen
* learn how to display an image on the micro:bit's LED screen
* learn how to pause your code for the specified number of milliseconds

View File

@ -18,7 +18,7 @@ basic.showLeds(`
### Challenge 1
Now show an new image that will display on the @boardname@.
Now show an new image that will display on the micro:bit.
```blocks
basic.showLeds(`

View File

@ -4,19 +4,19 @@ An introduction to conditions for the Block Editor.
## Introduction to conditions
In the introduction to code, we made the @boardname@ automatically shows the message hello world!:
In the introduction to code, we made the BBC micro:bit automatically shows the message hello world!:
```blocks
basic.showString("hello world!")
```
This statement, or code, will happen as soon as the @boardname@ is activated. This means it is unconditional. We can add a condition to make code function in certain ways:
This statement, or code, will happen as soon as the BBC micro:bit is activated. This means it is unconditional. We can add a condition to make code function in certain ways:
* A calculator waits for the user in input numbers and a function, before outputting a result
* A game waits for the user to press a button at the right time before outputting their score
* A quiz waits for the user to choose the correct option, and if they are wrong the quiz will tell the user
In programming we use an if statement: if this condition is met, do something. Lets add an if statement to the code we had before; the @boardname@ will wait for the user to press a button before showing the image.
In programming we use an if statement: if this condition is met, do something. Lets add an if statement to the code we had before; the BBC Micro:bit will wait for the user to press a button before showing the image.
```blocks
basic.forever(() => {
@ -40,9 +40,9 @@ You could now add additional conditions to your 'if statement'. Here are some id
What if the user does not press a button? What if the user presses the wrong button? We call this an else, because if the criteria of the if statement are not met then something else is done.
For example, we could make it so our @boardname@ tells us to press the A button. Remove the `button pressed` and `show string` blocks from the `if` block and right click it and select **Delete**. Now click the **If** category and drag out an `else if` block. Plug the `button pressed` and `show string` blocks in the correct places.
For example, we could make it so our BBC Micro:bit tells us to press the A button. Remove the `button pressed` and `show string` blocks from the `if` block and right click it and select **Delete**. Now click the **If** category and drag out an `else if` block. Plug the `button pressed` and `show string` blocks in the correct places.
We want the message "Press A!" to scroll across the @boardname@, so right-click the `show string` block and select **Duplicate**. Drag this new block into the `else` section and replace the “hello, world!” with "Press A!". Your code should look like this:
We want the message "Press A!" to scroll across the BBC micro:bit, so right-click the `show string` block and select **Duplicate**. Drag this new block into the `else` section and replace the “hello, world!” with "Press A!". Your code should look like this:
```blocks
basic.forever(() => {
@ -54,7 +54,7 @@ basic.forever(() => {
})
```
So, to recap: the `forever` block makes sure our code runs forever. The @boardname@ checks if the user is pressing the left button, if the user is not then the “Press the button!” message will scroll across the LEDs. If the user is pressing the button then the “hello, world!” message will scroll across the screen. Check this in the simulator or attach the @boardname@ to the computer then click **Download** to send the code onto the @boardname@.
So, to recap: the `forever` block makes sure our code runs forever. The BBC micro:bit checks if the user is pressing the left button, if the user is not then the “Press the button!” message will scroll across the LEDs. If the user is pressing the button then the “hello, world!” message will scroll across the screen. Check this in the simulator or attach the BBC micro:bit to the computer then click **Download** to send the code onto the BBC micro:bit.
## What is a condition?

View File

@ -1,6 +1,6 @@
# bop it challenges
a game similar to "Simon Says" with the @boardname@.
a game similar to "Simon Says" with the BBC micro:bit.
## Before we get started

View File

@ -45,7 +45,7 @@ if (action == 1) {
}
```
## 5. Write the code that increments the score if the @boardname@ logo is tilted down when the global variable called 'action' is equal to 1
## 5. Write the code that increments the score if the BBC micro:bit logo is tilted down when the global variable called 'action' is equal to 1
```blocks
input.onLogoDown(() => {
@ -65,7 +65,7 @@ if (action == 2) {
}
```
## 7. Write the code that increments the score if the @boardname@ is shaken when the global variable called 'action' is equal to 2
## 7. Write the code that increments the score if the BBC micro:bit is shaken when the global variable called 'action' is equal to 2
```blocks
input.onLogoDown(() => {

View File

@ -26,7 +26,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
<br />
### 5. Write the code that increments the score if the @boardname@ logo is tilted down when the global variable called 'action' is equal to 1
### 5. Write the code that increments the score if the BBC micro:bit logo is tilted down when the global variable called 'action' is equal to 1
<br />
@ -34,5 +34,5 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
<br />
### 7. Write the code that increments the score if the @boardname@ is shaken when the global variable called 'action' is equal to 2
### 7. Write the code that increments the score if the BBC micro:bit is shaken when the global variable called 'action' is equal to 2

View File

@ -47,5 +47,5 @@ game.removeLife(1);
* learn how to return the larger of two numbers
* learn how to return a random number
* learn how to return the modulus
* learn how to show a number of the @boardname@ screen
* learn how to show a number of the BBC micro:bit screen
* learn how to pause your code for the specified number of milliseconds

View File

@ -43,7 +43,7 @@ eggY = eggY + 1
led.plot(eggX, eggY)
```
## 4. . Write the code that resets the egg after it has fallen past the bottom of the @boardname@.
## 4. . Write the code that resets the egg after it has fallen past the bottom of the BBC micro:bit.
<br/>

View File

@ -24,7 +24,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
<br/>
## 4. Write the code that resets the egg after it has fallen past the bottom of the @boardname@.
## 4. Write the code that resets the egg after it has fallen past the bottom of the BBC micro:bit.
<br/>

View File

@ -1,15 +1,15 @@
# charting lesson
Create a charting app for simulating and measuring the acceleration applied to the @boardname@
Create a charting app for simulating and measuring the acceleration applied to the micro:bit
## Topic
Acceleration
## Quick Links
* [activity](/lessons/charting/activity)
* [challenge](/lessons/charting/challenge)
* [quiz](/lessons/charting/quiz)
* [activity](/lessons/charting/activity)
* [challenge](/lessons/charting/challenge)
* [quiz](/lessons/charting/quiz)
* [answers](/lessons/charting/quiz-answers)
## Prior learning/place of lesson in scheme of work
@ -22,8 +22,9 @@ Learn the functions of **on data received**, **send number** and **receive numbe
input.acceleration(Dimension.X)
led.plotBarGraph(0, 1023)
basic.showNumber(0)
radio.onDataPacketReceived(() => {})
radio.onDataReceived(() => {})
radio.sendNumber(0)
radio.receiveNumber()
```
## Objectives
@ -32,5 +33,5 @@ radio.sendNumber(0)
* learn how to get the acceleration value (g-force), in one of three specified dimensions
* learn how to display a vertical bar graph based on the value and high value.
* learn how to register code to run when a packet is received over radio
* learn how to broadcast a number data packet to other @boardname@s connected via radio
* learn how to broadcast a number data packet to other micro:bits connected via radio
* learn how to read the next radio packet as a number data packet

View File

@ -1,10 +1,10 @@
# Activity
Measure the acceleration on the @boardname@ in the "x" direction.
Measure the acceleration on the micro:bit in the "x" direction.
### ~avatar avatar
Welcome! This activity will teach how to use the @boardname@ to chart the acceleration in the "x" direction. Let's get started!
Welcome! This activity will teach how to use the micro:bit to chart the acceleration in the "x" direction. Let's get started!
### ~
@ -16,7 +16,7 @@ input.acceleration(Dimension.X)
```
### ~
Use the plot bar chart to visualize the acceleration on the LED screen of the @boardname@ in the specified range. You implement plot Bar Graph to display a vertical bar graph based on the "value" and "high" value. Then you must insert acceleration in the X dimension to measure the acceleration.
Use the plot bar chart to visualize the acceleration on the LED screen of the micro:bit in the specified range. You implement plot Bar Graph to display a vertical bar graph based on the "value" and "high" value. Then you must insert acceleration in the X dimension to measure the acceleration.
```blocks
basic.forever(() => {
@ -26,27 +26,27 @@ basic.forever(() => {
```
### ~
Notice that moving the @boardname@ in the simulator from left to right (x direction) changes the values beneath the @boardname@ in a range from 1023 to -1023 as measured in milli-gravities. By hovering over the @boardname@ from left to right, you can observe changing values beneath the @boardname@ simulator. Also, the LEDs shown on the Bar Graph fluctates based on the movement of the @boardname@ simulator in the x direction. The line underneath the @boardname@ simulator reflect the acceleration in the x direction.
Notice that moving the micro:bit in the simulator from left to right (x direction) changes the values beneath the micro:bit in a range from 1023 to -1023 as measured in milli-gravities. By hovering over the micro:bit from left to right, you can observe changing values beneath the micro:bit simulator. Also, the LEDs shown on the Bar Graph fluctates based on the movement of the micro:bit simulator in the x direction. The line underneath the micro:bit simulator reflect the acceleration in the x direction.
NOTE: The colors of the charts reflect the color of the @boardname@ simulator. In this instance, the @boardname@ is yellow. So the color of the data line reflects the color of the @boardname@
NOTE: The colors of the charts reflect the color of the micro:bit simulator. In this instance, the micro:bit is yellow. So the color of the data line reflects the color of the micro:bit
![](/static/mb/data4.png)
### ~
Vigorously move the @boardname@ in the @boardname@ simulatator by moving the @boardname@ image from side to side. Every time the @boardname@ moves in the x direction in the simulator, you are generating data points that can be reviewed in Excel. The more attempts to move the @boardname@ from side to side, the more data being saved in Excel. After you have vigarously moved the @boardname@ simulator from side to side for a sufficient amount of time, you are ready to graph or chart the accceleration of the @boardname@. We want a printout of our acceleration on Excel that can be graphed in Excel.
Vigorously move the micro:bit in the micro:bit simulatator by moving the micro:bit image from side to side. Every time the micro:bit moves in the x direction in the simulator, you are generating data points that can be reviewed in Excel. The more attempts to move the micro:bit from side to side, the more data being saved in Excel. After you have vigarously moved the micro:bit simulator from side to side for a sufficient amount of time, you are ready to graph or chart the accceleration of the micro:bit. We want a printout of our acceleration on Excel that can be graphed in Excel.
### ~
We want to chart the data collected by using a tool in Excel.
The final part of this experiment is opening and reviewing the data in the Excel CSV file. Simply click on the line beneath the simulator. A CSV file will be generated to display the data points collected by moving the @boardname@ in the X direction. Then click or tap on the data Excel file that was downloaded to your local ``Downloads`` Folder.
The final part of this experiment is opening and reviewing the data in the Excel CSV file. Simply click on the line beneath the simulator. A CSV file will be generated to display the data points collected by moving the micro:bit in the X direction. Then click or tap on the data Excel file that was downloaded to your local ``Downloads`` Folder.
### ~
First, click or tap on the first two columns (A, B) to include the time of the data being collected; b) the results of acceleration data on the @boardname@
First, click or tap on the first two columns (A, B) to include the time of the data being collected; b) the results of acceleration data on the micro:bit
![](/static/mb/data7.png)

View File

@ -1,12 +1,12 @@
# Challenge
# Challenge
### ~avatar avatar
### ~avatar avatar
Welcome! The activity will teach you how to use the acceleration of the 1st @boardname@ and to visualize the acceleration on the 2nd @boardname@.
Welcome! The activity will teach you how to use the acceleration of the 1st micro:bit and to visualize the acceleration on the 2nd micro:bit.
Let's get started!
### ~
Let's measure `acceleration (mg)` and then `send number`. `Acceleration` is measured in **milli-gravities**, so a value of -1000 is equivalent to -1g or -9.81m/s^2. We will be able to get the acceleration value (g-force), in the specified "x" dimension. `Send number` will broadcast a number data packet to other @boardname@s connected via radio.
Let's measure `acceleration (mg)` and then `send number`. `Acceleration` is measured in **milli-gravities**, so a value of -1000 is equivalent to -1g or -9.81m/s^2. We will be able to get the acceleration value (g-force), in the specified "x" dimension. `Send number` will broadcast a number data packet to other micro:bits connected via radio.
```blocks
radio.sendNumber(input.acceleration(Dimension.X));
@ -28,37 +28,37 @@ We want to register code to run when a packet is received over radio. We can imp
basic.forever(() => {
radio.sendNumber(input.acceleration(Dimension.X))
})
radio.onDataPacketReceived(() => {
radio.onDataReceived(() => {
})
```
### ~
Finally, we want to chart the acceleration. So we must first implement `plot bar graph`. `Plot Bar Graph` will display a vertical bar graph based on the value and high value. In order to transfer the receive the number from the 1st @boardname@, we must implement `receive number` to constantly display a vertical bar graph based on the value. Remember, the value will equal to the @boardname@'s acceleration in the "x" direction.
Finally, we want to chart the acceleration. So we must first implement `plot bar graph`. `Plot Bar Graph` will display a vertical bar graph based on the value and high value. In order to transfer the receive the number from the 1st micro:bit, we must implement `receive number` to constantly display a vertical bar graph based on the value. Remember, the value will equal to the micro:bit's acceleration in the "x" direction.
```blocks
basic.forever(() => {
radio.sendNumber(input.acceleration(Dimension.X))
})
radio.onDataPacketReceived(({ receivedNumber }) => {
led.plotBarGraph(receivedNumber, 1023)
radio.onDataReceived(() => {
led.plotBarGraph(radio.receiveNumber(), 1023)
})
```
### ~
Notice that moving the @boardname@ the farthest direction in the x direction will be -1023 on the charting beneath the simulator. The second observation will be that the LEDs will be full brightness on the 2nd @boardname@. There is a single LED turned on with the 1st @boardname@. Additionally, the graphs will reflect 0 acceleation for the 1st @boardname@. In this scenario, if you are adjusting the acceleration in the simualator, you are also changing your chart that will be produced.
Notice that moving the micro:bit the farthest direction in the x direction will be -1023 on the charting beneath the simulator. The second observation will be that the LEDs will be full brightness on the 2nd micro:bit. There is a single LED turned on with the 1st micro:bit. Additionally, the graphs will reflect 0 acceleation for the 1st micro:bit. In this scenario, if you are adjusting the acceleration in the simualator, you are also changing your chart that will be produced.
![](/static/mb/acc.png)
### ~
NOTE: The colors of the charts reflect the color of the @boardname@ simulator. In this instance, the @boardname@s are blue and green. So the colors of the line graphs reflect the colors of the @boardname@
NOTE: The colors of the charts reflect the color of the micro:bit simulator. In this instance, the micro:bits are blue and green. So the colors of the line graphs reflect the colors of the micro:bit
### ~
After running this simulation several seconds by moving the @boardname@ side to side in the x direction, you are ready to graph or chart the accceleration of the @boardname@. We want a printout of our acceleration on Excel. We will graph the fluctuating acceleration of the simulation experiment.
After running this simulation several seconds by moving the micro:bit side to side in the x direction, you are ready to graph or chart the accceleration of the micro:bit. We want a printout of our acceleration on Excel. We will graph the fluctuating acceleration of the simulation experiment.
![](/static/mb/acc2.png)
### ~
Finally, you must open the Excel CSV file by clicking on the data.xls file that was downloaded to Downloads Folder.
Finally, you must open the Excel CSV file by clicking on the data.xls file that was downloaded to Downloads Folder.
![](/static/mb/data3.png)
@ -81,11 +81,11 @@ Use the Recommended Charts command on the Insert tab to quickly create a chart t
### ~
Have fun reviewing your simulation and analyze the acceleration by chart the Excel data using Excel.
* Connect the first @boardname@ to your computer using your USB cable and run the charting script on it.
* Connect the second @boardname@ to your computer using your USB cable and run the charting script on it.
* The first person and second person take turns tilting the @boardname@ in the "x" direction while the other player charts the data on the @boardname@!
* Review and analyze the actual @boardname@ device acceleration data on Excel
* Display acceleration with y or z using plot bar graph by changing acceleration from "x" to "y" or "z"
* Connect the first micro:bit to your computer using your USB cable and run the charting script on it.
* Connect the second micro:bit to your computer using your USB cable and run the charting script on it.
* The first person and second person take turns tilting the micro:bit in the "x" direction while the other player charts the data on the micro:bit!
* Review and analyze the actual micro:bit device acceleration data on Excel
* Display acceleration with y or z using plot bar graph by changing acceleration from "x" to "y" or "z"
```package
radio

View File

@ -1,6 +1,6 @@
# charting quiz answers
Measure the acceleration on the @boardname@ in the "x" direction.
Measure the acceleration on the micro:bit in the "x" direction.
## Name
@ -25,7 +25,7 @@ We are creating a forever loop to constantly display the appropriate brightness
led.plotBarGraph(input.acceleration(Dimension.X), 0)
```
## 3. After vigarously moving the @boardname@ from side to side along the "x" axis for a sufficient amount of time,insert the Excel graph for displaying a line chart used to display trends over time.
## 3. After vigarously moving the micro:bit from side to side along the "x" axis for a sufficient amount of time,insert the Excel graph for displaying a line chart used to display trends over time.
<br/>

View File

@ -1,6 +1,6 @@
# charting quiz
Measure the acceleration on the @boardname@ in the "x" direction.
Measure the acceleration on the micro:bit in the "x" direction.
## Name
@ -18,6 +18,6 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
<br/>
## 3. After vigarously moving the @boardname@ from side to side along the "x" axis for a sufficient amount of time,insert the Excel graph for displaying a line chart used to display trends over time.
## 3. After vigarously moving the micro:bit from side to side along the "x" axis for a sufficient amount of time,insert the Excel graph for displaying a line chart used to display trends over time.

View File

@ -1,6 +1,6 @@
# classic beatbox
display beautiful images on the @boardname@.
display beautiful images on the BBC micro:bit.
## Topic
@ -19,5 +19,5 @@ Learn how to make a beatbox music player using pins P1 and P2. We will be learni
## Objectives
* learn how to code music on the @boardname@
* learn how to code music on the BBC micro:bit

View File

@ -1,6 +1,6 @@
# compass lesson
create a die on the @boardname@.
create a die on the BBC micro:bit.
## Topic
@ -36,7 +36,7 @@ basic.showLeds(`
## Objectives
* learn how to run code when the @boardname@ is shaken, when running code in the web browser, moving the mouse quickly simulates shaking
* learn how to run code when the BBC micro:bit is shaken, when running code in the web browser, moving the mouse quickly simulates shaking
* learn how to create a local variable as a place where you can store and retrieve data
* learn how the assignment operator is used to declare a new local variable
* learn how to declare a new local variable or update the value of a variable

View File

@ -1,10 +1,10 @@
# compass activity
Display the direction that the @boardname@ is facing using the compass
Display the direction that the micro:bit is facing using the compass
### ~avatar avatar
Welcome! This guided tutorial will show you how to program a script that displays the direction the @boardname@ is pointing. Let's get started!
Welcome! This guided tutorial will show you how to program a script that displays the direction the micro:bit is pointing. Let's get started!
### ~
@ -17,7 +17,7 @@ basic.forever(() => {
})
```
Store the reading of the @boardname@ in a variable called `degrees`.
Store the reading of the micro:bit in a variable called `degrees`.
```blocks
basic.forever(() => {
@ -25,7 +25,7 @@ basic.forever(() => {
})
```
If `degrees` is less than `45`, then the compass heading is mostly pointing toward North. Display `N` on the @boardname@.
If `degrees` is less than `45`, then the compass heading is mostly pointing toward North. Display `N` on the micro:bit.
```blocks
basic.forever(() => {
@ -36,7 +36,7 @@ basic.forever(() => {
});
```
If `degrees` is less than 135, the @boardname@ is mostly pointing East. Display `E` on the @boardname@.
If `degrees` is less than 135, the micro:bit is mostly pointing East. Display `E` on the micro:bit.
```blocks
@ -51,7 +51,7 @@ basic.forever(() => {
});
```
If `degrees` is less than 225, the @boardname@ is mostly pointing South. Display `S` on the @boardname@.
If `degrees` is less than 225, the micro:bit is mostly pointing South. Display `S` on the micro:bit.
```blocks
@ -70,7 +70,7 @@ basic.forever(() => {
```
If none of these conditions returned true, then the @boardname@ must be pointing West. Display `W` on the @boardname@.
If none of these conditions returned true, then the micro:bit must be pointing West. Display `W` on the micro:bit.
```blocks
basic.forever(() => {

View File

@ -1,6 +1,6 @@
# compass challenges
Display the direction that the @boardname@ is facing using the compass
Display the direction that the micro:bit is facing using the compass
## Before we get started
@ -27,7 +27,7 @@ basic.forever(() => {
### Challenge 1
Instead of displaying `N` when the @boardname@ is pointing North, display a star to indicate the north star.
Instead of displaying `N` when the BBC micro:bit is pointing North, display a star to indicate the north star.
```blocks
let degrees = 0;

View File

@ -12,7 +12,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
## 1. What is the purpose of the 'compass heading' block?
Gets the compass heading of the @boardname@ in degrees
Gets the compass heading of the micro:bit in degrees
## 2. Write the code that stores the compass heading into a local variable called 'degrees'.
@ -22,7 +22,7 @@ Gets the compass heading of the @boardname@ in degrees
let degrees = input.compassHeading()
```
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the @boardname@
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the micro:bit
```blocks
@ -32,7 +32,7 @@ if (degrees < 45) {
}
```
## 4. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the @boardname@
## 4. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the micro:bit
```blocks
@ -42,7 +42,7 @@ if (degrees < 135) {
}
```
## 5. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the @boardname@
## 5. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the micro:bit
```blocks

View File

@ -15,12 +15,12 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
## 2. Write the code that stores the compass heading into a local variable called 'degrees'.
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the @boardname@
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the micro:bit
## 4. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the @boardname@
## 4. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the micro:bit
## 5. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the @boardname@
## 5. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the micro:bit

View File

@ -33,5 +33,5 @@ input.onButtonPressed(Button.B, () => {
### Challenge 3
Now let's try to reset the counter when the @boardname@ is shaken. You will need to register an event handler with `on shake`.
Now let's try to reset the counter when the micro:bit is shaken. You will need to register an event handler with `on shake`.

View File

@ -1,6 +1,6 @@
# counter quiz answers
Learn how to create a counter with the @boardname@ button.
Learn how to create a counter with the BBC micro:bit button.
This is the answer key for the [counter quiz](/lessons/counter/quiz).
@ -32,7 +32,7 @@ input.onButtonPressed(Button.A, () => {
![](/static/mb/lessons/counter-1.png)
We are only pressing on button pressed once. So the number to display on the @boardname@ is also one.
We are only pressing on button pressed once. So the number to display on the micro:bit is also one.
<br/>
@ -48,7 +48,7 @@ input.onButtonPressed(Button.A, () => {
![](/static/mb/lessons/counter-2.png)
We included the code ``on button pressed("A")`` that runs each time the user presses A. The code increments `count` by `1`. We increase `count` by 1 whenever the user presses the button. So the third time the A button is pressed on the @boardname@, the number 3 is displayed
We included the code ``on button pressed("A")`` that runs each time the user presses A. The code increments `count` by `1`. We increase `count` by 1 whenever the user presses the button. So the third time the A button is pressed on the BBC micro:bit, the number 3 is displayed
<br/>

View File

@ -1,6 +1,6 @@
# counter quiz
Learn how to create a counter with the @boardname@ button.
Learn how to create a counter with the BBC micro:bit button.
## Name

View File

@ -1,6 +1,6 @@
# dice roll lesson
Create a dice on the @boardname@.
Create a dice on the BBC micro:bit.
## Topic
@ -35,7 +35,7 @@ basic.showLeds(`
## Objectives
* learn how to run code when the @boardname@ is shaken, when running code in the web browser, moving the mouse quickly simulates shaking
* learn how to run code when the BBC micro:bit is shaken, when running code in the web browser, moving the mouse quickly simulates shaking
* learn how to create a local variable as a place where you can store and retrieve data
* learn how the assignment operator is used to declare a new local variable
* learn how to declare a new local variable or update the value of a variable

View File

@ -1,6 +1,6 @@
# dice roll activity
Create a dice on the @boardname@
Create a dice on the micro:bit
### ~avatar avatar
@ -8,7 +8,7 @@ Welcome! This tutorial will help you create a dice. Let's get started!
### ~
Let's create a condition for when the @boardname@ is shaken.
Let's create a condition for when the micro:bit is shaken.
```blocks

View File

@ -1,6 +1,6 @@
# dice roll challenges
Create a dice on the @boardname@.
Create a dice on the micro:bit.
## Before we get started
@ -121,7 +121,7 @@ input.onGesture(Gesture.Shake, () => {
### Challenge 2
Let's make a trick dice! Modify the line of code with `pick random` so that only numbers 3-6 can appear on the dice. Also note that we need to ensure `roll = 0` when only 1 dot is shown on the @boardname@.
Let's make a trick dice! Modify the line of code with `pick random` so that only numbers 3-6 can appear on the dice. Also note that we need to ensure `roll = 0` when only 1 dot is shown on the BBC micro:bit.
```blocks
input.onGesture(Gesture.Shake, () => {
@ -179,5 +179,5 @@ input.onGesture(Gesture.Shake, () => {
### Challenge 3
Add a couple more conditions so that the @boardname@ randomly chooses a number between 1 and 8.
Add a couple more conditions so that the BBC micro:bit randomly chooses a number between 1 and 8.

View File

@ -1,6 +1,6 @@
# dice roll quiz answers
Create a dice when the @boardname@ is shaken
Create a dice when the BBC micro:bit is shaken
These are the answers to the [dice roll quiz](/lessons/dice-roll/quiz).

View File

@ -1,6 +1,6 @@
# dice roll quiz
Create a dice when the @boardname@ is shaken
Create a dice when the BBC micro:bit is shaken
## Name

View File

@ -62,7 +62,7 @@ while (count > 0) {
### Challenge 3
Now, we need `count` to decrease by one after the @boardname@ has displayed the value of `count`.
Now, we need `count` to decrease by one after the micro:bit has displayed the value of `count`.
We can do this by adding this line:

View File

@ -8,7 +8,7 @@ In this activity, you will learn how to blink an image on the LED screen.
### ~
Let's start by adding code that plots a heart image on the screen using `show LEDs`. Once you are done coding, don't forget to run your code in the simulator or the @boardname@.
Let's start by adding code that plots a heart image on the screen using `show LEDs`. Once you are done coding, don't forget to run your code in the simulator or the micro:bit.
```blocks

View File

@ -33,5 +33,5 @@ input.onButtonPressed(Button.B, () => {
### Challenge 3
Now let's try to reset the counter when the @boardname@ is shaken. You will need to register an event handler with `on shake`.
Now let's try to reset the counter when the micro:bit is shaken. You will need to register an event handler with `on shake`.

View File

@ -1,6 +1,6 @@
# game of chance blocks lesson
create an answering machine on the @boardname@
create an answering machine on the BBC micro:bit
## Topic

View File

@ -1,6 +1,6 @@
# game of chance blocks activity
Learn to create an answering machine on the @boardname@
Learn to create an answering machine on the micro:bit
We will use `show string` to show text on the LED screen. *String* is a common name for *text* in programming languages. The function `show string` scrolls the text column by column at a *150* milliseconds interval. If you want to speed up or down the scrolling, simply change the *150*.

View File

@ -28,7 +28,7 @@ input.onButtonPressed(Button.A, () => {
### Challenge 2
What if @boardname@'s answer to the question is GAME OVER? Let's have `GAME OVER` be displayed when button `B` is pressed. Add a condition for button `B` and inside it show the `GAME OVER`.
What if micro:bit's answer to the question is GAME OVER? Let's have `GAME OVER` be displayed when button `B` is pressed. Add a condition for button `B` and inside it show the `GAME OVER`.
```blocks
basic.showString("SELECT A BUTTON")

View File

@ -47,7 +47,7 @@ basic.forever(() => {
});
```
Since the @boardname@ will be swinging back and forth, the acceleration will only be positive half of the time. Thus, to always get a positive value, we want to take the absolute value of the acceleration.
Since the micro:bit will be swinging back and forth, the acceleration will only be positive half of the time. Thus, to always get a positive value, we want to take the absolute value of the acceleration.
```blocks
@ -64,7 +64,7 @@ basic.forever(() => {
});
```
The function `acceleration(y)` returns a number between 0 and 1024. We want to use this value for the brightness of the @boardname@, but the `set brightness()` only accepts a value between 0 and 256. Thus, we need to divide the acceleration by 4 to ensure we will be in the appropriate range.
The function `acceleration(y)` returns a number between 0 and 1024. We want to use this value for the brightness of the micro:bit, but the `set brightness()` only accepts a value between 0 and 256. Thus, we need to divide the acceleration by 4 to ensure we will be in the appropriate range.
```blocks
basic.showLeds(`
@ -82,7 +82,7 @@ basic.forever(() => {
```
Now let's use our acceleration value to set the brightness on the @boardname@.
Now let's use our acceleration value to set the brightness on the micro:bit.
```blocks
basic.showLeds(`

View File

@ -28,9 +28,9 @@ basic.forever(() => {
![](/static/mb/lessons/glowing-pendulum-0.jpg)
Hold the @boardname@ in your hand in a dark room. Move the @boardname@ like a pendulum and produce a slow image that captures the pattern of the @boardname@ LEDs.
Hold the micro:bit in your hand in a dark room. Move the micro:bit like a pendulum and produce a slow image that captures the pattern of the micro:bit LEDs.
### Challenge 2
Replace "y" in `acceleration(y)` with "x" or "z". Changing the axis will cause the @boardname@ to measure the force in a different direction. What differences in the resulting pattern does this replacement make?
Replace "y" in `acceleration(y)` with "x" or "z". Changing the axis will cause the micro:bit to measure the force in a different direction. What differences in the resulting pattern does this replacement make?

View File

@ -33,7 +33,7 @@ let acceleration = input.acceleration(Dimension.X)
let accelerationAbsolute = Math.abs(acceleration)
```
## 4. Write the code to use the acceleration value from question 3 to set the brightness on the @boardname@.
## 4. Write the code to use the acceleration value from question 3 to set the brightness on the BBC micro:bit.
<br/>

View File

@ -22,6 +22,6 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
<br/>
## 4. Write the code to include acceleration value question 3 to set the brightness on the @boardname@.
## 4. Write the code to include acceleration value question 3 to set the brightness on the BBC micro:bit.

View File

@ -1,12 +1,12 @@
# glowing pendulum block tutorial
The glowing pendulum changes the screen brightness based on the acceleration measured on the @boardname@.
The glowing pendulum changes the screen brightness based on the acceleration measured on the BBC micro:bit.
### Rebuild the game!
The blocks have been shuffled! Put them back together so that...
* all LEDs are turned on
* the @boardname@ repeats code **forever** that
* the BBC micro:bit repeats code **forever** that
* reads the acceleration along the ``y`` axis,
* calculate the absolute value of the acceleration
* scales down the acceleration value by a factor of `4`

View File

@ -4,13 +4,13 @@ An introduction to graphics for the Block Editor.
## Before we get started
Ensure you have completed the 'Hello, world!' and Loop tutorials and tested them on a simulator or on @boardname@.
Ensure you have completed the 'Hello, world!' and Loop tutorials and tested them on a simulator or on BBC micro:bit.
```blocks
basic.showString("HI!");
```
The @boardname@ has a grid of 25 LEDs, so we can use these to display images.
The BBC micro:bit has a grid of 25 LEDs, so we can use these to display images.
Weve already experimented with the `show string` block that displays a string (some text) that we program it to. However we can use more blocks from the **Images** drawer to render or display images in different ways.
@ -22,7 +22,7 @@ We can draw little images from the LEDs by ticking boxes. Drag a `show image` bl
### Plotting points
We can also code our bug to plot a point by giving an x (horizontal) and y (vertical) coordinates, from 0 to 4. Click the **LED** drawer and drag a `plot` block. Try changing the coordinates and see the effect this has on the @boardname@.
We can also code our bug to plot a point by giving an x (horizontal) and y (vertical) coordinates, from 0 to 4. Click the **LED** drawer and drag a `plot` block. Try changing the coordinates and see the effect this has on the BBC micro:bit.
We can also unplot a point (turn the LED off again) using the `unplot` block. So we could create a flashing LED program, using the `pause` block to create a delay.
@ -43,7 +43,7 @@ The pause block is in milliseconds, so setting it to 1000 will have a pause of a
### Devising algorithms for shapes
An algorithm is a set of steps to follow to solve a problem. We can begin to draw shapes on the @boardname@ using an algorithm.
An algorithm is a set of steps to follow to solve a problem. We can begin to draw shapes on the BBC micro:bit using an algorithm.
For example, we could draw a straight line with this code:
```blocks
@ -70,7 +70,7 @@ basic.forever(() => {
Animations are changes happening at a certain rate. For example, we could add the `pause` block from the **Basic** drawer with our square algorithm this will slowly draw a square (as an animation).
We could create more complex animations, for example we could make our @boardname@ display an explosion or fireworks.
We could create more complex animations, for example we could make our BBC micro:bit display an explosion or fireworks.
### Image variables

View File

@ -16,7 +16,7 @@ Math - Pick Random
## Prior learning/place of lesson in scheme of work
Learn how to create numbers randomly by using the input of the @boardname@. We will be learning how to create random numbers with input using a local variable as well as simple commands, such as pick number and show number.
Learn how to create numbers randomly by using the input of the BBC micro:bit. We will be learning how to create random numbers with input using a local variable as well as simple commands, such as pick number and show number.
## Documentation

View File

@ -1,16 +1,16 @@
# guess the number quiz answers
Learn how to generate a random number on the @boardname@.
Learn how to generate a random number on the micro:bit.
This is the answer key for the [guess the number quiz](/lessons/guess-the-number/quiz).
## 1. What is on button pressed?
Answers may vary. Generally, on button pressed run code when an input button is pressed. The @boardname@ has two input buttons: A and B.
Answers may vary. Generally, on button pressed run code when an input button is pressed. The micro:bit has two input buttons: A and B.
## 2. Consider the following directions
Write the line of code that creates a condition when the @boardname@ button A is pressed.
Write the line of code that creates a condition when the BBC micro:bit button A is pressed.
```blocks
@ -28,7 +28,7 @@ let randomNumber = Math.random(10)
```
## 4.
If the rectangle below represents the @boardname@, shade the areas that will be displayed. Explain why that particular area is shaded.
If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
```blocks
let randomNumber = Math.random(10)

View File

@ -1,6 +1,6 @@
# guess the number quiz
Learn how to generate a random number on the @boardname@.
Learn how to generate a random number on the micro:bit.
## Name

Some files were not shown because too many files have changed in this diff Show More