Merge remote-tracking branch 'origin/master'

This commit is contained in:
Matthias L. Jugel 2016-11-10 12:22:32 +01:00
commit 51e64bd82d
422 changed files with 28198 additions and 1886 deletions

View File

@ -15,7 +15,7 @@ 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.
* if not yet installed, install [Node.js 4.4.5 or higher](https://nodejs.org/en/download/)
* See requirements for [pxt](https://github.com/Microsoft/pxt)
* [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-calliope

View File

@ -1,4 +1,3 @@
///<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.
@ -41,7 +40,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)$/.test(port.name)) {
if (/^(micro:bit|touchdevelop|yelm|pxt|codemicrobit|codethemicrobit|pxt.microbit.org)$/.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: 5.9 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

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

View File

@ -1,22 +0,0 @@
{
"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"
}
]
}

View File

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

View File

@ -91,3 +91,10 @@ 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

@ -8,10 +8,10 @@
* [Projects](/projects)
* [Lessons](/lessons)
### Micro:bit reference
### @boardname@ reference
* [The micro:bit APIs](/reference)
* [The micro:bit device](/device)
* [The @boardname@ APIs](/reference)
* [The @boardname@ 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,4 +2,13 @@
### @description Frequently asked questions and answers from our users.
Please search for solutions or open a ticket at [support.microbit.org](https://support.microbit.org)!
## 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)!

View File

@ -1,6 +1,6 @@
# Getting started
### @description An activity for beginners to get started with the micro:bit
### @description An activity for beginners to get started with the @boardname@
## ~avatar
@ -35,7 +35,7 @@ When this program runs, you will see a smiley face, then a blank
screen, then a smiley again -- it never stops! (That's because of the
``forever`` block.)
Click **Download** to move your program to the BBC micro:bit!
Click **Download** to move your program to the @boardname@!
Make sure to follow the instructions.
### ~button /getting-started/screen

View File

@ -18,11 +18,11 @@ input.onButtonPressed(Button.A, () => {
#### ~hint
The ``showString`` block can show letters, numbers, and punctuation
on the micro:bit screen.
on the @boardname@ screen.
#### ~
Now try to unscramble these blocks in the editor so that the micro:bit
Now try to unscramble these blocks in the editor so that the @boardname@
shows **BANANA** when you press button `B`.
```shuffle
@ -37,7 +37,7 @@ You can find the letter `B` by clicking the letter `A` on the
#### ~
Click **Download** to move your program to the BBC micro:bit!
Click **Download** to move your program to the @boardname@!
#### 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 micro:bit board.) For example, hold
metal stripe at the bottom of the @boardname@ board.) For example, hold
the ``GND`` button with one hand and touch the ``0`` pin (called
``P0``) with your other hand to tell the micro:bit you're pressing it.
``P0``) with your other hand to tell the @boardname@ 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 BBC micro:bit!
Click **Download** to move your program to the @boardname@!
## ~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 BBC micro:bit to choose for you!
flipping machine with the @boardname@ to choose for you!
### ~
@ -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 micro:bit will
your score, and if you press `A` and `B` together, the @boardname@ 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 BBC micro:bit! You can play
the game with a friend who has it on a micro:bit. You can also play
Build a Rock Paper Scissors game with the @boardname@! You can play
the game with a friend who has it on a @boardname@. You can also play
it with friends who are just using their hands. (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 micro:bit to choose rock, paper, or scissors when you
We want the @boardname@ to choose rock, paper, or scissors when you
shake it. Try creating an ``on shake`` block so when you shake the
micro:bit, it will run part of a program.
@boardname@, 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 micro:bit, it should pick a random number from `0` to `2`
Next, when you shake the @boardname@, 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 micro:bit to show
Now we are going to add a new picture for the @boardname@ 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 BBC micro:bit!
Click **Download** to move your program to the @boardname@!
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 micro:bit will add `1` to your score.
the @boardname@ 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 micro:bit can add `1` to the score, show how many wins you have.
After your @boardname@ 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 micro:bit can track wins!
Success! Your @boardname@ 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 BBC micro:bit!
Click **Download** to move your program to the @boardname@!
### ~button /projects
NEXT: PROJECTS!

View File

@ -2,7 +2,7 @@
### ~avatar avatar
There are 25 bright LEDs on the micro:bit screen. Let's use them to create some cool animations!
There are 25 bright LEDs on the @boardname@ screen. Let's use them to create some cool animations!
### ~
@ -12,7 +12,7 @@ Draw an unhappy face instead of the blank screen. Click on the dots
in the second ``show leds`` block until it matches the blocks below.
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 micro:bit)!
you turn off your @boardname@)!
```blocks
basic.forever(() => {
@ -32,7 +32,7 @@ basic.forever(() => {
`)
});
```
Click **Download** to move your program to the BBC micro:bit!
Click **Download** to move your program to the @boardname@!
### Your turn!
@ -85,7 +85,7 @@ basic.forever(() => {
`)
});
```
Click **Download** to move your program to the BBC micro:bit!
Click **Download** to move your program to the @boardname@!
#### ~hint

View File

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

View File

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

View File

@ -1,8 +1,8 @@
# Call a function
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
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
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 micro:bit. Coming soon...
### Inheritance is not supported yet for the @boardname@. 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 micro:bit?
# What is the language supported for the @boardname@?
For the micro:bit, we support a "static" subset of TypeScript (itself a superset of JavaScript):
For the @boardname@, 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 micro:bit, you must specify a [type](/js/types) for each function parameter.
For the @boardname@, 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 micro:bit.
The following JavaScript operators are supported for the @boardname@.
### ~hint
Note that for the micro:bit all arithmetic is performed on integers, rather than floating point.
Note that for the @boardname@ 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 micro:bit, we don't allow a program to contain an empty statement, such as shown above.
For the @boardname@, 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 micro:bit:
The following JavaScript statements are supported for the @boardname@:
## 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 micro:bit, `numbers` are integer values.
However, for the @boardname@, `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 micro:bit, all elements of an array must have the same type.
For the @boardname@, 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 micro:bit.
The TypeScript type `any` is not supported in the @boardname@.
# Void

View File

@ -28,7 +28,7 @@
## Intermediate
* [Magic 8](/lessons/magic-8), a fortune teller game with the BBC micro:bit
* [Magic 8](/lessons/magic-8), a fortune teller game with the @boardname@
* [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 BBC micro:bit is pointing with compass
* [Compass](/lessons/compass), displays the direction the @boardname@ 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 BBC micro:bit
* [Hero](/lessons/hero), reconstruct the classic arcade game pac man with the @boardname@
* [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 BBC micro:bit
Create an answering machine on the @boardname@
## Topic

View File

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

View File

@ -12,7 +12,7 @@ basic.showString("ASK ME A QUESTION")
### Challenge 1
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`.
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`.
```blocks
basic.showString("ASK ME A QUESTION")
@ -25,7 +25,7 @@ input.onButtonPressed(Button.A, () => {
### Challenge 2
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`.
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`.
```blocks
basic.showString("ASK ME A QUESTION")

View File

@ -1,6 +1,6 @@
# answering machine blocks quiz answers
Create an answering machine on the micro:bit.
Create an answering machine on the @boardname@.
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 micro:bit, write the code to display the letter "Z".
## 4. If the rectangle below represents the @boardname@, 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 micro:bit.
Create an answering machine on the @boardname@.
## Name
@ -36,7 +36,7 @@ basic.showString("Hi")
![](/static/mb/lessons/answering-machine-4.png)
## 4. If the rectangle below represents the micro:bit, write the code to display the letter "Z".
## 4. If the rectangle below represents the @boardname@, 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 BBC micro:bit.
Display beautiful images on the @boardname@.
## 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 BBC micro:bit'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 @boardname@'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 micro:bit's LED screen
* learn how to display an image on the @boardname@'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 micro:bit.
Now show an new image that will display on the @boardname@.
```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 BBC micro:bit automatically shows the message hello world!:
In the introduction to code, we made the @boardname@ automatically shows the message hello world!:
```blocks
basic.showString("hello world!")
```
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:
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:
* 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 BBC Micro:bit 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 @boardname@ 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 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.
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.
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:
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:
```blocks
basic.forever(() => {
@ -54,7 +54,7 @@ basic.forever(() => {
})
```
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.
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@.
## What is a condition?

View File

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

View File

@ -45,7 +45,7 @@ if (action == 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
## 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
```blocks
input.onLogoDown(() => {
@ -65,7 +65,7 @@ if (action == 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
## 7. Write the code that increments the score if the @boardname@ 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 BBC micro:bit logo is tilted down when the global variable called 'action' is equal to 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
<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 BBC micro:bit is shaken when the global variable called 'action' is equal to 2
### 7. Write the code that increments the score if the @boardname@ 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 BBC micro:bit screen
* learn how to show a number of the @boardname@ 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 BBC micro:bit.
## 4. . Write the code that resets the egg after it has fallen past the bottom of the @boardname@.
<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 BBC micro:bit.
## 4. Write the code that resets the egg after it has fallen past the bottom of the @boardname@.
<br/>

View File

@ -1,15 +1,15 @@
# charting lesson
Create a charting app for simulating and measuring the acceleration applied to the micro:bit
Create a charting app for simulating and measuring the acceleration applied to the @boardname@
## 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,9 +22,8 @@ Learn the functions of **on data received**, **send number** and **receive numbe
input.acceleration(Dimension.X)
led.plotBarGraph(0, 1023)
basic.showNumber(0)
radio.onDataReceived(() => {})
radio.onDataPacketReceived(() => {})
radio.sendNumber(0)
radio.receiveNumber()
```
## Objectives
@ -33,5 +32,5 @@ radio.receiveNumber()
* 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 micro:bits connected via radio
* learn how to broadcast a number data packet to other @boardname@s 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 micro:bit in the "x" direction.
Measure the acceleration on the @boardname@ in the "x" direction.
### ~avatar avatar
Welcome! This activity will teach how to use the micro:bit to chart the acceleration in the "x" direction. Let's get started!
Welcome! This activity will teach how to use the @boardname@ 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 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.
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.
```blocks
basic.forever(() => {
@ -26,27 +26,27 @@ basic.forever(() => {
```
### ~
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.
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.
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
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@
![](/static/mb/data4.png)
### ~
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.
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.
### ~
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 micro:bit 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 @boardname@ 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 micro:bit
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@
![](/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 micro:bit and to visualize the acceleration on the 2nd micro:bit.
Welcome! The activity will teach you how to use the acceleration of the 1st @boardname@ and to visualize the acceleration on the 2nd @boardname@.
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 micro:bits 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 @boardname@s 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.onDataReceived(() => {
radio.onDataPacketReceived(() => {
})
```
### ~
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.
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.
```blocks
basic.forever(() => {
radio.sendNumber(input.acceleration(Dimension.X))
})
radio.onDataReceived(() => {
led.plotBarGraph(radio.receiveNumber(), 1023)
radio.onDataPacketReceived(({ receivedNumber }) => {
led.plotBarGraph(receivedNumber, 1023)
})
```
### ~
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.
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.
![](/static/mb/acc.png)
### ~
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
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@
### ~
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.
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.
![](/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 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"
* 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"
```package
radio

View File

@ -1,6 +1,6 @@
# charting quiz answers
Measure the acceleration on the micro:bit in the "x" direction.
Measure the acceleration on the @boardname@ 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 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.
## 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.
<br/>

View File

@ -1,6 +1,6 @@
# charting quiz
Measure the acceleration on the micro:bit in the "x" direction.
Measure the acceleration on the @boardname@ 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 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.
## 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.

View File

@ -1,6 +1,6 @@
# classic beatbox
display beautiful images on the BBC micro:bit.
display beautiful images on the @boardname@.
## 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 BBC micro:bit
* learn how to code music on the @boardname@

View File

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

View File

@ -1,6 +1,6 @@
# compass challenges
Display the direction that the micro:bit is facing using the compass
Display the direction that the @boardname@ is facing using the compass
## Before we get started
@ -27,7 +27,7 @@ basic.forever(() => {
### Challenge 1
Instead of displaying `N` when the BBC micro:bit is pointing North, display a star to indicate the north star.
Instead of displaying `N` when the @boardname@ 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 micro:bit in degrees
Gets the compass heading of the @boardname@ 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 micro:bit 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 micro:bit
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the @boardname@
```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 micro:bit
## 4. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the @boardname@
```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 micro:bit
## 5. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the @boardname@
```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 micro:bit
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the @boardname@
## 4. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the micro:bit
## 4. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the @boardname@
## 5. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the micro:bit
## 5. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the @boardname@

View File

@ -33,5 +33,5 @@ input.onButtonPressed(Button.B, () => {
### Challenge 3
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`.
Now let's try to reset the counter when the @boardname@ 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 BBC micro:bit button.
Learn how to create a counter with the @boardname@ 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 micro:bit is also one.
We are only pressing on button pressed once. So the number to display on the @boardname@ 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 BBC micro:bit, 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 @boardname@, the number 3 is displayed
<br/>

View File

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

View File

@ -1,6 +1,6 @@
# dice roll lesson
Create a dice on the BBC micro:bit.
Create a dice on the @boardname@.
## Topic
@ -35,7 +35,7 @@ basic.showLeds(`
## Objectives
* 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 run code when the @boardname@ 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 micro:bit
Create a dice on the @boardname@
### ~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 micro:bit is shaken.
Let's create a condition for when the @boardname@ is shaken.
```blocks

View File

@ -1,6 +1,6 @@
# dice roll challenges
Create a dice on the micro:bit.
Create a dice on the @boardname@.
## 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 BBC micro:bit.
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@.
```blocks
input.onGesture(Gesture.Shake, () => {
@ -179,5 +179,5 @@ input.onGesture(Gesture.Shake, () => {
### Challenge 3
Add a couple more conditions so that the BBC micro:bit randomly chooses a number between 1 and 8.
Add a couple more conditions so that the @boardname@ randomly chooses a number between 1 and 8.

View File

@ -1,6 +1,6 @@
# dice roll quiz answers
Create a dice when the BBC micro:bit is shaken
Create a dice when the @boardname@ 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 BBC micro:bit is shaken
Create a dice when the @boardname@ is shaken
## Name

View File

@ -62,7 +62,7 @@ while (count > 0) {
### Challenge 3
Now, we need `count` to decrease by one after the micro:bit has displayed the value of `count`.
Now, we need `count` to decrease by one after the @boardname@ 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 micro:bit.
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@.
```blocks

View File

@ -33,5 +33,5 @@ input.onButtonPressed(Button.B, () => {
### Challenge 3
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`.
Now let's try to reset the counter when the @boardname@ 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 BBC micro:bit
create an answering machine on the @boardname@
## Topic

View File

@ -1,6 +1,6 @@
# game of chance blocks activity
Learn to create an answering machine on the micro:bit
Learn to create an answering machine on the @boardname@
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 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`.
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`.
```blocks
basic.showString("SELECT A BUTTON")

View File

@ -47,7 +47,7 @@ basic.forever(() => {
});
```
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.
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.
```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 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.
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.
```blocks
basic.showLeds(`
@ -82,7 +82,7 @@ basic.forever(() => {
```
Now let's use our acceleration value to set the brightness on the micro:bit.
Now let's use our acceleration value to set the brightness on the @boardname@.
```blocks
basic.showLeds(`

View File

@ -28,9 +28,9 @@ basic.forever(() => {
![](/static/mb/lessons/glowing-pendulum-0.jpg)
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.
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.
### Challenge 2
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?
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?

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 BBC micro:bit.
## 4. Write the code to use the acceleration value from question 3 to set the brightness on the @boardname@.
<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 BBC micro:bit.
## 4. Write the code to include acceleration value question 3 to set the brightness on the @boardname@.

View File

@ -1,12 +1,12 @@
# glowing pendulum block tutorial
The glowing pendulum changes the screen brightness based on the acceleration measured on the BBC micro:bit.
The glowing pendulum changes the screen brightness based on the acceleration measured on the @boardname@.
### Rebuild the game!
The blocks have been shuffled! Put them back together so that...
* all LEDs are turned on
* the BBC micro:bit repeats code **forever** that
* the @boardname@ 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 BBC micro:bit.
Ensure you have completed the 'Hello, world!' and Loop tutorials and tested them on a simulator or on @boardname@.
```blocks
basic.showString("HI!");
```
The BBC micro:bit has a grid of 25 LEDs, so we can use these to display images.
The @boardname@ 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 BBC micro:bit.
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 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 BBC micro:bit using an algorithm.
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.
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 BBC micro:bit display an explosion or fireworks.
We could create more complex animations, for example we could make our @boardname@ 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 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.
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.
## Documentation

View File

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

View File

@ -1,6 +1,6 @@
# happy birthday blocks lesson
display beautiful images on the BBC micro:bit.
display beautiful images on the @boardname@.
## Topic
@ -13,10 +13,10 @@ Music
## Prior learning/place of lesson in scheme of work
Learn how to convert your BBC micro:bit into a music player using pins P0 and GND, earphones (or speakers), as well as crocodile clips (or spring clips).
Learn how to convert your @boardname@ into a music player using pins P0 and GND, earphones (or speakers), as well as crocodile clips (or spring clips).
We will be learning how to code musical notes using simple commands such as play, keys, and notes.
## Objectives
* learn how to code music on the BBC micro:bit
* learn how to setup the BBC micro:bit as a music player
* learn how to code music on the @boardname@
* learn how to setup the @boardname@ as a music player

View File

@ -2,9 +2,9 @@
Play sounds with music blocks.
Have you ever tried to play a song on an instrument? Let's try coding the song "Happy Birthday" on the micro:bit !
Have you ever tried to play a song on an instrument? Let's try coding the song "Happy Birthday" on the @boardname@ !
Let's start by adding the code in the music drawer that includes a single musical chord (or pitched sound) with the `play` block. Then insert the chord "C". Once you are done coding, don't forget to run your code in the simulator or the micro:bit.
Let's start by adding the code in the music drawer that includes a single musical chord (or pitched sound) with the `play` block. Then insert the chord "C". Once you are done coding, don't forget to run your code in the simulator or the @boardname@.
```blocks
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));

View File

@ -100,5 +100,5 @@ music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
### Challenge 3
You now have a the ability to create music on the micro:bit. Try to code another favourite song.
You now have a the ability to create music on the @boardname@. Try to code another favourite song.

View File

@ -61,10 +61,10 @@ Learn how to create a charades game with **collections**, ` create -> Collection
* learn how to create a global variable as a place where you can store data so that you can use it later in your code, accessible across functions and in nested code blocks
* learn how to repeat code in the background forever
* learn how to learn how to conditionally run code depending on whether a condition is true or not
* learn how to run code when the BBC micro:bit is oriented perpendicular to the floor with the logo down
* learn how to run code when the @boardname@ is oriented perpendicular to the floor with the logo down
* learn how to get the number of milliseconds elapsed since the script began
* learn how to show a string on the BBC micro:bit screen
* learn how to show a number of the BBC micro:bit screen
* learn how to show a string on the @boardname@ screen
* learn how to show a number of the @boardname@ screen
## Links to the National Curriculum Programmes of Study for Computing

View File

@ -8,7 +8,7 @@ This tutorial will teach you how to create a hero game to capture food while dod
### ~
First we need to create a function create sprite at the x, y coordinates and that set the variable called hero on the micro:bit the first time we play.
First we need to create a function create sprite at the x, y coordinates and that set the variable called hero on the @boardname@ the first time we play.
```blocks
@ -17,7 +17,7 @@ let hero = game.createSprite(2, 2)
```
Let's set up where we want our ghost will be. Create starting positions of the hero, ghost, and food in each individual quadrant. We will ensure that the ghost, food, and hero is set apart. Divide the micro:bit into 4 quadrants. We don't want hero to be too close to the ghost so let's make the ghost starting positions in the 3 other quadrants. Hero is in the one quadrant. To do this, we need to keep track of the middle point in each quadrant. Create sprite at the x, y coordinates for the hero, food, and ghost.
Let's set up where we want our ghost will be. Create starting positions of the hero, ghost, and food in each individual quadrant. We will ensure that the ghost, food, and hero is set apart. Divide the @boardname@ into 4 quadrants. We don't want hero to be too close to the ghost so let's make the ghost starting positions in the 3 other quadrants. Hero is in the one quadrant. To do this, we need to keep track of the middle point in each quadrant. Create sprite at the x, y coordinates for the hero, food, and ghost.
```blocks
let hero = game.createSprite(2, 2)

View File

@ -16,7 +16,7 @@ for (let i = 0; i < 4; i++) {
}
```
If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
If the rectangle below represents the @boardname@, shade the areas that will be displayed. Explain why that particular area is shaded.
Let's create a for loop where `0` is the loop's starting value, `i` is the index variable, and `4` is the ending value. The index variable `i` starts at 0 and increases by 1 each time through the loop. The loop ends when `i = 4`.
@ -30,7 +30,7 @@ for (let i1 = 0; i1 < 6; i1++) {
}
```
If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
If the rectangle below represents the @boardname@, shade the areas that will be displayed. Explain why that particular area is shaded.
Let's create a for loop where `0` is the loop's starting value, `i` is the index variable, and `6` is the ending value. The index variable `i` starts at 0 and increases by 1 each time through the loop. The loop ends when `i = 6`.

View File

@ -1,6 +1,6 @@
# love meter blocks lesson
Create a love meter with the BBC micro:bit.
Create a love meter with the @boardname@.
## Topic

View File

@ -1,10 +1,10 @@
# love meter blocks activity
Create a love meter with the micro:bit
Create a love meter with the @boardname@
### ~avatar avatar
Welcome! This activity will help you create a love meter with the micro:bit. Let's get started!
Welcome! This activity will help you create a love meter with the @boardname@. Let's get started!
### ~
@ -28,7 +28,7 @@ input.onPinPressed(TouchPin.P0, () => {
```
Finally, let's show that number on the micro:bit. You are registering an event handler that will execute on the BBC micro:bit whenever the user holds the GND pin with one hand, and presses pin 0 with the other hand, thus completing a circuit
Finally, let's show that number on the @boardname@. You are registering an event handler that will execute on the @boardname@ whenever the user holds the GND pin with one hand, and presses pin 0 with the other hand, thus completing a circuit
```blocks

View File

@ -1,6 +1,6 @@
# love meter blocks challenges
Create a love meter with the micro:bit
Create a love meter with the @boardname@
## Before we get started

View File

@ -39,7 +39,7 @@ basic.showNumber(item + 1);
You have to add 1 if you want to generate a random number between 1 and 10 .
## 5. Why do you have to hold ground (GND) to make this work on the micro:bit?
## 5. Why do you have to hold ground (GND) to make this work on the @boardname@?
You have told GND to complete the circuit.

View File

@ -34,6 +34,6 @@ basic.showNumber(item + 1);
## 5. Describe why you must hold ground (GND) before pressing (P0) to run a program using `on pin pressed(P0)` on the micro:bit
## 5. Describe why you must hold ground (GND) before pressing (P0) to run a program using `on pin pressed(P0)` on the @boardname@

View File

@ -1,6 +1,6 @@
# lucky 7 blocks quiz answers
Show a number on the micro:bit.
Show a number on the @boardname@.
This is the answer key for the [lucky 7 quiz](/lessons/lucky-7/quiz).
@ -26,7 +26,7 @@ basic.showNumber(21)
![](/static/mb/lessons/lucky-7-1.png)
## 4. Write the code that will be used to display the number 3 on the micro:bit.
## 4. Write the code that will be used to display the number 3 on the @boardname@.
![](/static/mb/lessons/lucky-7-2.png)

View File

@ -1,6 +1,6 @@
# lucky 7 blocks quiz
Show a number on the micro:bit
Show a number on the @boardname@
## Name
@ -33,7 +33,7 @@ basic.showNumber(21)
## 4. Write the code that will be used to display the number 3 on the micro:bit.
## 4. Write the code that will be used to display the number 3 on the @boardname@.
![](/static/mb/lessons/lucky-7-3.png)

View File

@ -1,6 +1,6 @@
# magic 8 lesson
a fortune teller game with the BBC micro:bit.
a fortune teller game with the @boardname@.
## Topic

View File

@ -1,6 +1,6 @@
# magic 8 activity
Welcome! This activity will help you create a magic 8 ball on the micro:bit. Let's get started!
Welcome! This activity will help you create a magic 8 ball on the @boardname@. Let's get started!
Show a string to instruct the user how to play Magic 8! The magic 8 ball can only answer true or false questions.
@ -17,7 +17,7 @@ basic.showString("ASK A QUESTION")
basic.showNumber(8)
```
Create a condition for when the micro:bit is shaken. Then use the block `clear screen` to clear the 8 from the display.
Create a condition for when the @boardname@ is shaken. Then use the block `clear screen` to clear the 8 from the display.
```blocks
basic.showString("ASK A QUESTION")

View File

@ -1,6 +1,6 @@
# magic 8 quiz answers
create a magic 8 ball on the BBC micro:bit.
create a magic 8 ball on the @boardname@.
## Name

View File

@ -1,6 +1,6 @@
# magic 8 quiz
create a magic 8 ball on the BBC micro:bit.
create a magic 8 ball on the @boardname@.
## Name

View File

@ -6,7 +6,7 @@ Show a string to instruct the user how to play Magic 8! The magic 8 ball can onl
The blocks have been shuffled! Put them back together so that...
* show "ASK A QUESTION" on the screen
* when the micro:bit is shaken,
* when the @boardname@ is shaken,
* generate a random number between 0 and 2.
* if the number is `2`, show "YES"
* if the number is `1`, show "NO"

View File

@ -17,7 +17,7 @@ On Logo Up
## Prior learning/place of lesson in scheme of work
Learn how to plot image **on logo up**, `on logo up` to run code when the micro:bit screen is facing up and vertically orientated. We will be learning how to plot an image with the logo up, basic show LEDs, and logo down.
Learn how to plot image **on logo up**, `on logo up` to run code when the @boardname@ screen is facing up and vertically orientated. We will be learning how to plot an image with the logo up, basic show LEDs, and logo down.
## Documentation
```cards
@ -34,7 +34,7 @@ basic.showLeds(`
## Objectives
* learn how to display an image on the micro:bit's LED screen
* learn how to run code when the micro:bit screen is facing down and vertically orientated
* learn how to run code when the micro:bit screen is facing up and vertically orientated
* learn how to display an image on the @boardname@'s LED screen
* learn how to run code when the @boardname@ screen is facing down and vertically orientated
* learn how to run code when the @boardname@ screen is facing up and vertically orientated

View File

@ -8,7 +8,7 @@ Welcome! This tutorial will help you display an arrow pointing toward the logo!
### ~
Using the **accelerometer** sensor, the micro:bit can detect when the **logo** is oriented **up**. We call that the **logo up** event. We will use `on logo up` to register an event handler that will run when the **logo up** event happens.
Using the **accelerometer** sensor, the @boardname@ can detect when the **logo** is oriented **up**. We call that the **logo up** event. We will use `on logo up` to register an event handler that will run when the **logo up** event happens.
```blocks
input.onGesture(Gesture.LogoUp, () => {
@ -16,7 +16,7 @@ input.onGesture(Gesture.LogoUp, () => {
})
```
When the micro:bit goes logo up, the code nested under the `on logo up` function will run. Let's add a line of code to show LEDs in there.
When the @boardname@ goes logo up, the code nested under the `on logo up` function will run. Let's add a line of code to show LEDs in there.
```blocks
input.onGesture(Gesture.LogoUp, () => {
@ -30,7 +30,7 @@ input.onGesture(Gesture.LogoUp, () => {
})
```
Run your code and try to turn around the micro:bit to see the **logo up** event in action!
Run your code and try to turn around the @boardname@ to see the **logo up** event in action!
### ~avatar boothing

View File

@ -12,11 +12,11 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
## 1. Define 'on logo up'
A function that will run code when the BBC micro:bit screen is facing up and vertically orientated.
A function that will run code when the @boardname@ screen is facing up and vertically orientated.
<br/>
## 2. Write the condition that detects when the BBC micro:bit logo is facing up and vertically orientated.
## 2. Write the condition that detects when the @boardname@ logo is facing up and vertically orientated.
The `logo up` event is raised when...

View File

@ -12,9 +12,9 @@ Use the hints from the [magic logo activity](/lessons/magic-logo/activity) to an
<br/>
## 2. Write the condition that detects when the BBC micro:bit logo is facing up and vertically orientated.
## 2. Write the condition that detects when the @boardname@ logo is facing up and vertically orientated.
## 3. Write the code to display a downward pointing arrow when the BBC micro:bit logo is down.
## 3. Write the code to display a downward pointing arrow when the @boardname@ logo is down.
![](/static/mb/lessons/magic-logo-0.png)

View File

@ -1,6 +1,6 @@
# night light lesson
change the brightness of the BBC micro:bit.
change the brightness of the @boardname@.
## Topic

View File

@ -1,10 +1,10 @@
# night light activity
Change the brightness of the micro:bit.
Change the brightness of the @boardname@.
### ~avatar avatar
Welcome! This tutorial will teach you how to change the brightness of the micro:bit. Let's get started!
Welcome! This tutorial will teach you how to change the brightness of the @boardname@. Let's get started!
### ~

View File

@ -12,7 +12,7 @@ This function sets the brightness of the LED screen.
![](/static/mb/lessons/night-light-0.png)
If the rectangle above represents the BBC micro:bit, write the code to set all the LEDs to full brightness and to turn on all the LEDs.
If the rectangle above represents the @boardname@, write the code to set all the LEDs to full brightness and to turn on all the LEDs.
<br />
@ -31,7 +31,7 @@ basic.showLeds(`
![](/static/mb/lessons/night-light-1.png)
If the rectangle above represents the BBC micro:bit, write the code to set the screen brightness to 50% (128) and turns on all the LEDs.
If the rectangle above represents the @boardname@, write the code to set the screen brightness to 50% (128) and turns on all the LEDs.
<br/>
@ -50,7 +50,7 @@ basic.showLeds(`
![](/static/mb/lessons/night-light-2.png)
If the rectangle above represents the BBC micro:bit, write the code to turn off all the LEDs.
If the rectangle above represents the @boardname@, write the code to turn off all the LEDs.
```blocks
led.setBrightness(0)

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