pxt-microbit Accessibility PR (#529)

* Accessibility changes
This commit is contained in:
Sam El-Husseini 2017-09-07 13:42:08 -07:00 committed by GitHub
parent 3f87576a50
commit e3975e65e5
357 changed files with 1641 additions and 3540 deletions

View File

@ -47,7 +47,7 @@
* [Plot light level](/examples/plot-light-level) * [Plot light level](/examples/plot-light-level)
* [Plot analog pin](/examples/plot-analog-pin) * [Plot analog pin](/examples/plot-analog-pin)
* [Servo Calibrator](/examples/servo-calibrator) * [Servo Calibrator](/examples/servo-calibrator)
* [Game of Life](/examples/gameofLife) * [Game of Life](/examples/gameofLife)
## #courses ## #courses

View File

@ -2,7 +2,7 @@
# About # About
### @description A Blocks / Javascript code editor for the micro:bit, a pocket-size computer with 5x5 display, sensors and Bluetooth. ## @description A Blocks / Javascript code editor for the micro:bit, a pocket-size computer with 5x5 display, sensors and Bluetooth.
The [BBC micro:bit](https://microbit.org) is a [pocket-size computer](/device) with a 5x5 display of 25 LEDs, Bluetooth and sensors that can be programmed by anyone. The BBC micro:bit was made possible by many [partners](https://www.microbit.co.uk/partners). The [BBC micro:bit](https://microbit.org) is a [pocket-size computer](/device) with a 5x5 display of 25 LEDs, Bluetooth and sensors that can be programmed by anyone. The BBC micro:bit was made possible by many [partners](https://www.microbit.co.uk/partners).
@ -15,11 +15,11 @@ Just like Arduino, the micro:bit can be connected to and interact with sensors,
The BBC micro:bit is packaged with sensors, radio and other goodies. Learn about the [hardware components](/device) of the micro:bit to make the most of it! The BBC micro:bit is packaged with sensors, radio and other goodies. Learn about the [hardware components](/device) of the micro:bit to make the most of it!
### ~ hint ## ~ hint
**Looking to buy a micro:bit?** See the [list of resellers](https://microbit.org/resellers). **Looking to buy a micro:bit?** See the [list of resellers](https://microbit.org/resellers).
### ~ ## ~
## Programming: [Blocks](/blocks) or [JavaScript](/javascript) ## Programming: [Blocks](/blocks) or [JavaScript](/javascript)

View File

@ -1,3 +1,3 @@
{ {
"appref": "v0.12" "appref": "v0.13"
} }

View File

@ -2,7 +2,7 @@
## #examples ## #examples
### Example: ``AND`` operator ## Example: ``AND`` operator
This example turns on LED `3 , 3`, if LEDs `1 , 1` and `2 , 2` are both on: This example turns on LED `3 , 3`, if LEDs `1 , 1` and `2 , 2` are both on:
@ -12,7 +12,7 @@ if (led.point(1,1) && led.point(2,2)) {
} }
``` ```
### Example: Comparisons of numbers and strings ## Example: Comparisons of numbers and strings
When you compare two Numbers, you get a Boolean value, such as the comparison `x < 5` in the code below: When you compare two Numbers, you get a Boolean value, such as the comparison `x < 5` in the code below:

View File

@ -2,7 +2,7 @@
## #examples ## #examples
### Example: adjusting screen brightness ## 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: If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255` when the button A is pressed:

View File

@ -1,3 +1,3 @@
# @extends # @extends
### #specific ## #specific

View File

@ -2,7 +2,7 @@
## #examples ## #examples
### Example: Count to 4 ## Example: Count to 4
This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen. This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen.

View File

@ -2,7 +2,7 @@
## #examples ## #examples
### Example: diagonal line ## Example: diagonal line
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`). 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`).

View File

@ -6,7 +6,7 @@ or [string](/types/string) you say.
When you use the equals sign to store something in a variable, the equals sign is called When you use the equals sign to store something in a variable, the equals sign is called
an *assignment operator*, and what you store is called a *value*. an *assignment operator*, and what you store is called a *value*.
### Storing numbers in variables ## Storing numbers in variables
This program makes the variable `item` equal `5` and then shows it on the [LED screen](/device/screen). This program makes the variable `item` equal `5` and then shows it on the [LED screen](/device/screen).
@ -15,7 +15,7 @@ let item = 5
basic.showNumber(item) basic.showNumber(item)
```` ````
### Storing strings in variables ## Storing strings in variables
This program makes the variable `name` equal `Joe` and then shows it on the [LED screen](/device/screen). This program makes the variable `name` equal `Joe` and then shows it on the [LED screen](/device/screen).
@ -24,13 +24,13 @@ let name = "Joe"
basic.showString(name); basic.showString(name);
```` ````
### Notes ## Notes
You can use the assignment operator with variables of You can use the assignment operator with variables of
every [type](/types). A *type* is which kind of thing every [type](/types). A *type* is which kind of thing
a variable can store, like a number or string. a variable can store, like a number or string.
### See also ## See also
[variable](/blocks/variables/var), [types](/types) [variable](/blocks/variables/var), [types](/types)

View File

@ -2,7 +2,7 @@
## #examples ## #examples
### Example: show the value of a variable ## Example: show the value of a variable
Use the assignment operator to set the value of a [variable](/blocks/variables/var). Change the value of a variable from 0 to 1 using the change item block. Then display the new value of the variable on the LED screen. Like this: Use the assignment operator to set the value of a [variable](/blocks/variables/var). Change the value of a variable from 0 to 1 using the change item block. Then display the new value of the variable on the LED screen. Like this:

View File

@ -2,7 +2,7 @@
How to define and use local variables. How to define and use local variables.
### @parent language ## @parent language
A variable is a place where you can store and retrieve data. Variables have a name, a [type](/types), and value: A variable is a place where you can store and retrieve data. Variables have a name, a [type](/types), and value:
@ -10,7 +10,7 @@ A variable is a place where you can store and retrieve data. Variables have a na
* *type* refers to the kind of data a variable can store * *type* refers to the kind of data a variable can store
* *value* refers to what's stored in the variable * *value* refers to what's stored in the variable
### Var statement ## Var statement
Use the Block Editor variable statement to create a variable Use the Block Editor variable statement to create a variable
and the [assignment operator](/blocks/variables/assign) and the [assignment operator](/blocks/variables/assign)
@ -35,7 +35,7 @@ A variable is created for the number returned by the [brightness](/reference/led
let b = led.brightness(); let b = led.brightness();
``` ```
### Using variables ## Using variables
Once you've defined a variable, just use the variable's name whenever you need what's stored in the variable. For example, the following code shows the value stored in `counter` on the LED screen: Once you've defined a variable, just use the variable's name whenever you need what's stored in the variable. For example, the following code shows the value stored in `counter` on the LED screen:
@ -52,7 +52,7 @@ counter = counter + 10;
basic.showNumber(counter); basic.showNumber(counter);
``` ```
### Why use variables? ## Why use variables?
If you want to remember and modify data, you'll need a variable. If you want to remember and modify data, you'll need a variable.
A counter is a great example: A counter is a great example:
@ -65,7 +65,7 @@ input.onButtonPressed(Button.A, () => {
}); });
``` ```
### Local variables ## Local variables
Local variables exist only within the function or block of code where they're defined. For example: Local variables exist only within the function or block of code where they're defined. For example:
@ -77,11 +77,11 @@ if (led.brightness() > 128) {
} }
``` ```
#### Notes ### Notes
* You can use the default variable names if you'd like, however, it's best to use descriptive variable names. To change a variable name in the editor, select the down arrow next to the variable and then click "new variable". * You can use the default variable names if you'd like, however, it's best to use descriptive variable names. To change a variable name in the editor, select the down arrow next to the variable and then click "new variable".
### See also ## See also
[types](/types), [assignment operator](/blocks/variables/assign) [types](/types), [assignment operator](/blocks/variables/assign)

View File

@ -2,21 +2,21 @@
Through math class, most middle school students are already familiar with coordinate grids and mapping x and y coordinates on a plane. To review some terms: Through math class, most middle school students are already familiar with coordinate grids and mapping x and y coordinates on a plane. To review some terms:
#### Axes ## Axes
* The basic coordinate grid a student learns has two axes, * The basic coordinate grid a student learns has two axes,
>* an x-axis which runs horizontally and >* an x-axis which runs horizontally and
* a y-axis which runs vertically. * a y-axis which runs vertically.
#### Origin ## Origin
* These two axes meet at a point called the origin where both the x and the y values are zero. * These two axes meet at a point called the origin where both the x and the y values are zero.
* On this basic coordinate grid, the origin is in the lower left corner of the grid and has the coordinates (0,0). * On this basic coordinate grid, the origin is in the lower left corner of the grid and has the coordinates (0,0).
#### Coordinate pair ## Coordinate pair
* The first value in a coordinate pair is the x value and the second value in a coordinate pair is the y value. * The first value in a coordinate pair is the x value and the second value in a coordinate pair is the y value.
* A simple way to remember which value comes first is to remember their order in the alphabet. The letter x comes before the letter y in the alphabet and the x coordinate comes before the y coordinate in a coordinate pair. * A simple way to remember which value comes first is to remember their order in the alphabet. The letter x comes before the letter y in the alphabet and the x coordinate comes before the y coordinate in a coordinate pair.
#### Coordinate value changes ## Coordinate value changes
* On a basic coordinate grid, * On a basic coordinate grid,
>* the value of the x coordinate increases left to right and is a measure of how many units a point is horizontally from the origin >* the value of the x coordinate increases left to right and is a measure of how many units a point is horizontally from the origin

View File

@ -39,7 +39,7 @@ Since their grid is only one quarter the size of the original Battleship grid, s
The game can be played with just paper and pencils or you could use small tokens and markers, like coins, buttons, or paper clips to represent the ships. The game can be played with just paper and pencils or you could use small tokens and markers, like coins, buttons, or paper clips to represent the ships.
   
### Notes: ## Notes:
* Place students grids in sheet protectors or laminate them so they can be used again and again with white board (dry erase) markers. * Place students grids in sheet protectors or laminate them so they can be used again and again with white board (dry erase) markers.
* The official rules of Battleship are easily found on the internet. Modify them as needed for your particular class. * The official rules of Battleship are easily found on the internet. Modify them as needed for your particular class.

View File

@ -77,7 +77,7 @@ Because students are working on the projects in class, and much of the benefit c
A work log is a short, bullet point list of what they worked on, and how long it took. Stick to the facts. It shouldnt take more than thirty seconds or so to write up a work log. Students should do one for every class. A shared Microsoft OneNote notebook is a great way to keep a work log that students can update regularly. Alternately, you might use a collaborative shared document, or your classroom management system, or even e-mail. A work log is a short, bullet point list of what they worked on, and how long it took. Stick to the facts. It shouldnt take more than thirty seconds or so to write up a work log. Students should do one for every class. A shared Microsoft OneNote notebook is a great way to keep a work log that students can update regularly. Alternately, you might use a collaborative shared document, or your classroom management system, or even e-mail.
#### Sample Work Log ### Sample Work Log
>**_April 11_**<br/> >**_April 11_**<br/>
_20 min. Created code that reacts when pins P0 and P1 are pressed._<br/> _20 min. Created code that reacts when pins P0 and P1 are pressed._<br/>
_0 min. Talked with Mr. Kiang about how to attach wires so they wont fall off_<br/> _0 min. Talked with Mr. Kiang about how to attach wires so they wont fall off_<br/>

View File

@ -1,18 +1,18 @@
# Device # Device
### ~ hint ## ~ hint
**Looking to buy a micro:bit?** See the [list of resellers](https://microbit.org/resellers). **Looking to buy a micro:bit?** See the [list of resellers](https://microbit.org/resellers).
### ~ ## ~
All the bits and pieces that make up the BBC micro:bit All the bits and pieces that make up the BBC micro:bit
![](/static/mb/device-0.png) ![](/static/mb/device-0.png)
### LED Screen and Status LED ## LED Screen and Status LED
The red lights are [LEDs](/device/screen) (light emitting diodes) and form a 5 x 5 LED Screen. The red lights are [LEDs](/device/screen) (light emitting diodes) and form a 5 x 5 LED Screen.
They can be set to on/off and the brightness can be controlled. They can be set to on/off and the brightness can be controlled.
@ -20,7 +20,7 @@ They can be set to on/off and the brightness can be controlled.
The yellow light on the back of the micro:bit is the status LED. The yellow light on the back of the micro:bit is the status LED.
It flashes yellow when the system wants to tell the user that something has happened. It flashes yellow when the system wants to tell the user that something has happened.
### Buttons ## Buttons
Buttons A and B are a form of input. When you press a button, it completes an electrical circuit. Buttons A and B are a form of input. When you press a button, it completes an electrical circuit.
The micro:bit can detect either of its two buttons being pressed/released and be programmed The micro:bit can detect either of its two buttons being pressed/released and be programmed
@ -29,7 +29,7 @@ to act on these events.
Button R on the back of the micro:bit is a system button. It has different uses. Button R on the back of the micro:bit is a system button. It has different uses.
When you have downloaded and run your code onto your micro:bit, press Button R to restart and run your program from the beginning. When you have downloaded and run your code onto your micro:bit, press Button R to restart and run your program from the beginning.
### USB connection ## USB connection
When you plug in your micro:bit via [USB](/device/usb), it should appear as a ``MICROBIT`` drive. When you plug in your micro:bit via [USB](/device/usb), it should appear as a ``MICROBIT`` drive.
@ -38,7 +38,7 @@ the micro:bit will appear as a MAINTENANCE drive instead of ``MICROBIT``. This i
To continue programming your micro:bit YOU MUST unplug your USB and reconnect it. Check that the drive now shows as ``MICROBIT``. To continue programming your micro:bit YOU MUST unplug your USB and reconnect it. Check that the drive now shows as ``MICROBIT``.
### ~ hint ## ~ hint
Use with caution. If you click on the drive while it shows as ``MAINTENANCE``, Use with caution. If you click on the drive while it shows as ``MAINTENANCE``,
you can see which version of firmware you have running on your micro:bit. you can see which version of firmware you have running on your micro:bit.
@ -47,31 +47,31 @@ You can find the version of firmware in the 'version.txt' file on the micro:bit.
https://developer.mbed.org/platforms/Microbit/#firmware https://developer.mbed.org/platforms/Microbit/#firmware
### ~ ## ~
### Compass ## Compass
The compass can detect magnetic fields such as the Earths magnetic field. The compass can detect magnetic fields such as the Earths magnetic field.
As the micro:bit has this compass, it is possible to detect the direction it is moving in. As the micro:bit has this compass, it is possible to detect the direction it is moving in.
The micro:bit can detect where it is facing and movement in degrees. The micro:bit can detect where it is facing and movement in degrees.
This data can be used by the micro:bit in a program or be sent to another device. This data can be used by the micro:bit in a program or be sent to another device.
### Accelerometer ## Accelerometer
There is an accelerometer on your micro:bit which detects changes in the micro:bits speed. There is an accelerometer on your micro:bit which detects changes in the micro:bits speed.
It converts analogue information into digital form that can be used in micro:bit programs. It converts analogue information into digital form that can be used in micro:bit programs.
Output is in milli-g. The device will also detect a small number of standard actions e.g. shake, tilt and free-fall. Output is in milli-g. The device will also detect a small number of standard actions e.g. shake, tilt and free-fall.
### Pins ## Pins
The [pins](/device/pins) can be a form of electrical input or output. The [pins](/device/pins) can be a form of electrical input or output.
There are labels for the input/output pins ``P0``, ``P1``, ``P2``, which you can attach external sensors to such as thermometers or moisture detectors. There are labels for the input/output pins ``P0``, ``P1``, ``P2``, which you can attach external sensors to such as thermometers or moisture detectors.
### Light level ## Light level
The screen can also be used a light level sensor (it's a really cool trick). The screen can also be used a light level sensor (it's a really cool trick).
### Runtime ## Runtime
The micro:bit embodies many fundamental concepts in computer science. To learn more, read [the micro:bit - a reactive system](/device/reactive). The micro:bit embodies many fundamental concepts in computer science. To learn more, read [the micro:bit - a reactive system](/device/reactive).
@ -80,15 +80,15 @@ Sometimes, your micro:bit may display an error code. For more information, see:
* [the error codes](/device/error-codes) * [the error codes](/device/error-codes)
### How do I connect the micro:bit to my computer? ## How do I connect the micro:bit to my computer?
Your micro:bit can be connected to your computer via a micro USB cable. Your micro:bit can be connected to your computer via a micro USB cable.
Data can be sent and received between the micro:bit and the computer so programs Data can be sent and received between the micro:bit and the computer so programs
can be downloaded from Windows, Macs and Chromebooks onto the micro:bit via this USB data connection. can be downloaded from Windows, Macs and Chromebooks onto the micro:bit via this USB data connection.
You can read more information on how to run scripts on your micro:bit [here](/device/usb), [Click here to read more information on how to run scripts on your micro:bit](/device/usb),
and about the error messages you might get [here](/device/error-codes). and [click here to read more about the error messages you might get](/device/error-codes).
### Powering your micro:bit ## Powering your micro:bit
When your micro:bit is connected to your computer with the micro USB, it doesnt need another power source. When your micro:bit is connected to your computer with the micro USB, it doesnt need another power source.
When your micro:bit isnt connected to your computer, tablet or mobile, you will need 2 x AAA 1.5 V batteries to power it. When your micro:bit isnt connected to your computer, tablet or mobile, you will need 2 x AAA 1.5 V batteries to power it.
@ -96,11 +96,11 @@ When your micro:bit isnt connected to your computer, tablet or mobile, you wi
The pins labelled 3V and GND are the power supply pins. The pins labelled 3V and GND are the power supply pins.
You can attach an external device such as a motor to these and power it using the battery or USB. You can attach an external device such as a motor to these and power it using the battery or USB.
### Serial Communication ## Serial Communication
The micro:bit can send an receive data via [serial communication](/device/serial). The serial data can be transfered via USB or BLE. The micro:bit can send an receive data via [serial communication](/device/serial). The serial data can be transfered via USB or BLE.
### Bluetooth Low Energy (BLE) Antenna ## Bluetooth Low Energy (BLE) Antenna
You will see the label BLE ANTENNA on the back of your micro:bit. It is for a messaging service, You will see the label BLE ANTENNA on the back of your micro:bit. It is for a messaging service,
so that devices can talk to each other. The micro:bit is a peripheral so that devices can talk to each other. The micro:bit is a peripheral
@ -108,7 +108,7 @@ device which can talk to a central device like a smart phone or tablet that has
The micro:bit can send signals and receive signals from a central device so another BLE device can The micro:bit can send signals and receive signals from a central device so another BLE device can
control the micro:bit or the micro:bit can control another BLE device. control the micro:bit or the micro:bit can control another BLE device.
### Technical Information ## Technical Information
The micro:bit has been designed to be a bare-board micro controller for use by children aged 11-12. The micro:bit has been designed to be a bare-board micro controller for use by children aged 11-12.
More information is available at the [Microbit Foundation web site](https://microbit.org/device). More information is available at the [Microbit Foundation web site](https://microbit.org/device).

View File

@ -1,16 +1,16 @@
# crocodile clips # Crocodile clips
The large holes at the bottom of the board are designed to attach alligator/crocodile clips The large holes at the bottom of the board are designed to attach alligator/crocodile clips
to create electrical circuit with other components. to create electrical circuit with other components.
# ~hint # ~hint
**No crocodile clips!?!?!** Use wires or Aluminium foil! [Read more...](/device/foil-circuits) **No crocodile clips!?!?!** Use [wires or aluminium foil](/device/foil-circuits)!
# ~ # ~
## Connecting Crocodile Clips ## Connecting crocodile clips
The hole for ``P0`` and ``GND`` allow to grab the board on the side which makes for a great grip. The hole for ``P0`` and ``GND`` allow to grab the board on the side which makes for a great grip.

View File

@ -22,6 +22,6 @@ basic.showLeds(`
`) `)
``` ```
### See also ## See also
[panic](/reference/control/panic), [assert](/reference/control/assert), [panic](/reference/control/panic), [assert](/reference/control/assert),

View File

@ -8,14 +8,14 @@ We will show you how to connect the @boardname@ to headphones using Alumunium fo
https://youtu.be/mhXYyPuvpz0 https://youtu.be/mhXYyPuvpz0
### Materials ## Materials
* @boardname@ and battery pack (you can also power it via USB) * @boardname@ and battery pack (you can also power it via USB)
* a small piece of cardboard * a small piece of cardboard
* Aluminium foil * Aluminium foil
* tape * tape
### Assembly instructions ## Assembly instructions
Tape the @boardname@ and battery pack to the card board. Make sure to remove the batteries while you are building your circuit. Tape the @boardname@ and battery pack to the card board. Make sure to remove the batteries while you are building your circuit.

View File

@ -8,7 +8,7 @@ The micro:bit has 25 external connections on the edge connector of the board, wh
There are five large pins, that are also connected to holes in the board labelled: 0, 1, 2, 3V, and GND. And along the same edge, there are 20 small pins that you can use when plugging the micro:bit into an edge connector. There are five large pins, that are also connected to holes in the board labelled: 0, 1, 2, 3V, and GND. And along the same edge, there are 20 small pins that you can use when plugging the micro:bit into an edge connector.
### Large pins ## Large pins
You can easily attach crocodile clips or 4mm banana plugs to the five large pins. You can easily attach crocodile clips or 4mm banana plugs to the five large pins.
@ -20,11 +20,11 @@ The first three, labelled 0, 1 and 2 are flexible and can be used for many diffe
The other two large pins (3V and GND) are very different!/td/td The other two large pins (3V and GND) are very different!/td/td
### ~hint ## ~hint
Watch out! The pins labelled 3V and GND relate to the power supply of the board, and they should NEVER be connected together. Watch out! The pins labelled 3V and GND relate to the power supply of the board, and they should NEVER be connected together.
### ~ ## ~
*power input*: If the micro:bit is powered by USB or a battery, then you can use the 3V pin as a *power output* to power peripherals with. *power input*: If the micro:bit is powered by USB or a battery, then you can use the 3V pin as a *power output* to power peripherals with.
@ -33,7 +33,7 @@ Watch out! The pins labelled 3V and GND relate to the power supply of the board,
If you hold the GND pin with one hand, you can program the microbit to detect yourself touching the 0,1 or 2 pins with your other hand, giving you three more buttons to experiment with (you just used your body to complete an electrical circuit). If you hold the GND pin with one hand, you can program the microbit to detect yourself touching the 0,1 or 2 pins with your other hand, giving you three more buttons to experiment with (you just used your body to complete an electrical circuit).
### Small pins ## Small pins
There are 20 small pins numbered sequentially from 3-22 (these pins are not labeled on the micro:bit, however, they are labelled in the picture above). There are 20 small pins numbered sequentially from 3-22 (these pins are not labeled on the micro:bit, however, they are labelled in the picture above).
@ -57,7 +57,7 @@ Unlike the three large pins that are dedicated to being used for external connec
* **pins 19 and 20**: implement the clock signal (SCL) and data line (SDA) of the I2C bus communication protocol. With I2C, several devices can be connected on the same bus and send/read messages to and from the CPU. Internally, the accelerometer and the compass are connected to i2c. * **pins 19 and 20**: implement the clock signal (SCL) and data line (SDA) of the I2C bus communication protocol. With I2C, several devices can be connected on the same bus and send/read messages to and from the CPU. Internally, the accelerometer and the compass are connected to i2c.
* **pins 21 and 22**: these pins are wired to the GND pin and serve no other function * **pins 21 and 22**: these pins are wired to the GND pin and serve no other function
### Connecting to the small pins ## Connecting to the small pins
It is recommended that an edge connector be acquired to connect to the small pins. More information on compatible edge connectors will be available later. It is recommended that an edge connector be acquired to connect to the small pins. More information on compatible edge connectors will be available later.

View File

@ -1,18 +1,18 @@
# The micro:bit - a reactive system # The micro:bit - a reactive system
### Computing systems ## Computing systems
What sort of a *computing system* is the micro:bit? What sort of a *computing system* is the micro:bit?
### ~hint ## ~hint
There are different types of computing systems, to address different kinds of problems that arise in practice: *transaction processing systems* are used by banks to handle huge numbers of financial transactions by their customers; *distributed systems* make a set of networked computers appear as one big computer (like Googles search engine); there are also *parallel systems*, such as graphic cards, which perform a huge number of primitive operations simultaneously, using a great number of small processing cores. There are different types of computing systems, to address different kinds of problems that arise in practice: *transaction processing systems* are used by banks to handle huge numbers of financial transactions by their customers; *distributed systems* make a set of networked computers appear as one big computer (like Googles search engine); there are also *parallel systems*, such as graphic cards, which perform a huge number of primitive operations simultaneously, using a great number of small processing cores.
### ~ ## ~
The micro:bit is a *reactive system* it reacts continuously to external events, such as a person pressing the A button of the micro:bit or shaking the device. The reaction to an event may be to perform a computation, update variables, and change the display. After the device reacts to an event, it is ready to react to the next one. If this sounds like a computer game, thats because most computer games are reactive systems too! The micro:bit is a *reactive system* it reacts continuously to external events, such as a person pressing the A button of the micro:bit or shaking the device. The reaction to an event may be to perform a computation, update variables, and change the display. After the device reacts to an event, it is ready to react to the next one. If this sounds like a computer game, thats because most computer games are reactive systems too!
### Responsiveness ## Responsiveness
We want reactive systems to be responsive, which means to react in a timely manner to events. For example, when you play a computer game, its frustrating if you press a button to make a character jump, but it doesnt immediately jump. A delay in reacting, or lack of responsiveness , can be the difference between life and death, both in the real and virtual worlds. We want reactive systems to be responsive, which means to react in a timely manner to events. For example, when you play a computer game, its frustrating if you press a button to make a character jump, but it doesnt immediately jump. A delay in reacting, or lack of responsiveness , can be the difference between life and death, both in the real and virtual worlds.
@ -20,7 +20,7 @@ Lets consider a simple example: you want to program your micro:bit to accurat
Lets say that the current count is 42 and the number 42 is scrolling across the LED screen. This means there is some code executing to perform the scroll. So, what should happen if you press the A button during the scroll? It would be a bad idea to ignore the button press, so some code should record the occurrence of the button press. But we just said there already is code running in order to scroll the number 42! If we wait until the code scrolling the 42 has finished to look for a button press, we will miss the button press. We want to avoid this sort of unresponsiveness. Lets say that the current count is 42 and the number 42 is scrolling across the LED screen. This means there is some code executing to perform the scroll. So, what should happen if you press the A button during the scroll? It would be a bad idea to ignore the button press, so some code should record the occurrence of the button press. But we just said there already is code running in order to scroll the number 42! If we wait until the code scrolling the 42 has finished to look for a button press, we will miss the button press. We want to avoid this sort of unresponsiveness.
### Concurrency ## Concurrency
To be responsive, a reactive system needs to be able to do several things at the same time (concurrently), just like you can. But the micro:bit only has one CPU for executing your program, which means it can only execute one program instruction at a time. On the other hand, it can execute millions of instructions in a single second. This points the way to a solution. To be responsive, a reactive system needs to be able to do several things at the same time (concurrently), just like you can. But the micro:bit only has one CPU for executing your program, which means it can only execute one program instruction at a time. On the other hand, it can execute millions of instructions in a single second. This points the way to a solution.
@ -42,7 +42,7 @@ TODO Diagram
As well soon see, there are other choices for how the sequences can be ordered to achieve the desired result. As well soon see, there are other choices for how the sequences can be ordered to achieve the desired result.
### The micro:bit scheduler and queuing up subprograms ## The micro:bit scheduler and queuing up subprograms
The micro:bits *scheduler* provides the capability to concurrently execute different code sequences, relieving us of a lot of low-level programming. In fact, scheduling is so useful that it is a part of every *operating system*! The micro:bits *scheduler* provides the capability to concurrently execute different code sequences, relieving us of a lot of low-level programming. In fact, scheduling is so useful that it is a part of every *operating system*!
@ -90,7 +90,7 @@ The function ends after the execution of these three statements, but this is not
The second job of the scheduler is to periodically interrupt execution to read (poll) the various inputs to the micro:bit (the buttons, pins, etc.) and fire off events (such as “button A pressed”). Recall that the firing of an event causes the event handler subprogram associated with that event to be queued for later execution. The scheduler uses a timer built into the micro:bit hardware to interrupt execution every 6 milliseconds and poll the inputs, which is more than fast enough to catch the quickest press of a button. The second job of the scheduler is to periodically interrupt execution to read (poll) the various inputs to the micro:bit (the buttons, pins, etc.) and fire off events (such as “button A pressed”). Recall that the firing of an event causes the event handler subprogram associated with that event to be queued for later execution. The scheduler uses a timer built into the micro:bit hardware to interrupt execution every 6 milliseconds and poll the inputs, which is more than fast enough to catch the quickest press of a button.
### Cooperative passing of control ## Cooperative passing of control
How does the forever loop get to start execution? Furthermore, once the forever loop is running, how does any other subprogram (like the event handler that increments the count) ever get a chance to execute? How does the forever loop get to start execution? Furthermore, once the forever loop is running, how does any other subprogram (like the event handler that increments the count) ever get a chance to execute?
@ -117,7 +117,7 @@ The `forever` loop actually is a function that takes a subprogram (an *Action* i
Though the `while true` loop will repeatedly execute the body subprogram, between each execution of the body it will permit the scheduler to execute other subprograms. If the while loop did not contain the call to `pause`, then once control passed into the while loop, it would never pass back to the scheduler and no other subprogram would be able to execute (unless the body subprogram contained a call to `pause` itself). Though the `while true` loop will repeatedly execute the body subprogram, between each execution of the body it will permit the scheduler to execute other subprograms. If the while loop did not contain the call to `pause`, then once control passed into the while loop, it would never pass back to the scheduler and no other subprogram would be able to execute (unless the body subprogram contained a call to `pause` itself).
### Round-robin scheduling ## Round-robin scheduling
Now, we come to the third and final job of the scheduler, which is to determine which subprogram to pass control to next. The scheduler uses two queues to perform this task, the sleep queue and the run queue. The sleep queue contains the subprograms that have called the pause function and still have time left to sleep. The run queue contains all the non-sleeping subprograms, such as the event handlers queued by the firing of an event. Now, we come to the third and final job of the scheduler, which is to determine which subprogram to pass control to next. The scheduler uses two queues to perform this task, the sleep queue and the run queue. The sleep queue contains the subprograms that have called the pause function and still have time left to sleep. The run queue contains all the non-sleeping subprograms, such as the event handlers queued by the firing of an event.
@ -125,7 +125,7 @@ The scheduler moves the subprogram that has just paused into the sleep queue an
The property of such round-robin scheduling is that under the assumption that every subprogram periodically enters the sleep queue, then every subprogram will periodically get a chance to execute. The property of such round-robin scheduling is that under the assumption that every subprogram periodically enters the sleep queue, then every subprogram will periodically get a chance to execute.
### Putting it all together ## Putting it all together
Lets go back to the `count button presses` function and revisit its execution based on what we have learned about the micro:bit scheduler. As detailed before, the function executes three steps to: (1) set up the event handler for each press of button A; (2) queue the forever loop to the run queue; (3) initialize the global variable `count` to zero. Lets go back to the `count button presses` function and revisit its execution based on what we have learned about the micro:bit scheduler. As detailed before, the function executes three steps to: (1) set up the event handler for each press of button A; (2) queue the forever loop to the run queue; (3) initialize the global variable `count` to zero.
@ -135,7 +135,7 @@ The function then ends execution and control passes back to the scheduler. Let
While "Show 0" (the blue sequence) is running, periodic interrupts by the scheduler (every 6 milliseconds) poll for button presses and queue an event handler for each press of button A. Lets say that one button press takes place during this time, as shown above. This will cause an event handler (labelled “inc”) to be queued for later execution by the scheduler. Once the "Show 0" has completed, the loop then calls `basic -> pause(20)` to put the forever loop to sleep for 20 milliseconds and give the scheduler an opportunity to run any newly queued event handler. Control passes to the “inc” event handler which will increment the global variable `count` from 0 to 1 and then complete, returning control to the scheduler. At some point, the `forever` loop moves from the sleep queue to the run queue; the `forever` loop then will resume and call `basic -> show number(1,150)`. While "Show 0" (the blue sequence) is running, periodic interrupts by the scheduler (every 6 milliseconds) poll for button presses and queue an event handler for each press of button A. Lets say that one button press takes place during this time, as shown above. This will cause an event handler (labelled “inc”) to be queued for later execution by the scheduler. Once the "Show 0" has completed, the loop then calls `basic -> pause(20)` to put the forever loop to sleep for 20 milliseconds and give the scheduler an opportunity to run any newly queued event handler. Control passes to the “inc” event handler which will increment the global variable `count` from 0 to 1 and then complete, returning control to the scheduler. At some point, the `forever` loop moves from the sleep queue to the run queue; the `forever` loop then will resume and call `basic -> show number(1,150)`.
### Final thoughts ## Final thoughts
Through this example, we have seen that the micro:bit scheduler enables you to create a program that is composed of concurrent subprograms. In essence, the programmer needs to only think about the concurrent subprograms cooperatively passing control back to the scheduler, making sure no subprogram hogs control (or “dribbles the ball without passing”) for too long. While a subprogram runs, the scheduler polls the buttons and other IO peripherals at a high frequency in order to fire off events and queue event handlers for later execution, but this is invisible to the programmer. Through this example, we have seen that the micro:bit scheduler enables you to create a program that is composed of concurrent subprograms. In essence, the programmer needs to only think about the concurrent subprograms cooperatively passing control back to the scheduler, making sure no subprogram hogs control (or “dribbles the ball without passing”) for too long. While a subprogram runs, the scheduler polls the buttons and other IO peripherals at a high frequency in order to fire off events and queue event handlers for later execution, but this is invisible to the programmer.

View File

@ -15,7 +15,7 @@ The micro:bit LED screen
The micro:bit LED screen consists of 25 red LED lights arranged in a 5X5 grid (5 LEDs across by 5 LEDs down). The micro:bit LED screen consists of 25 red LED lights arranged in a 5X5 grid (5 LEDs across by 5 LEDs down).
In the screen above, we created a checkerboard pattern using the LEDs. In the screen above, we created a checkerboard pattern using the LEDs.
### Which LED? ## Which LED?
You use `(x ,y)` coordinates to specify a particular LED in the grid; You use `(x ,y)` coordinates to specify a particular LED in the grid;
where `x` is the horizontal position (0,1,2,3,4) and `y` is the vertical position where `x` is the horizontal position (0,1,2,3,4) and `y` is the vertical position
@ -37,17 +37,17 @@ Here are the x, y coordinates for the LEDs in the 5X5 grid:
The x, y coordinates for the LED in the centre of the grid are `(2,2)`. Starting from `(0,0)` count over 2 columns and then down 2 rows. The x, y coordinates for the LED in the centre of the grid are `(2,2)`. Starting from `(0,0)` count over 2 columns and then down 2 rows.
### Check your understanding ## Check your understanding
Which LEDs are turned on in the checkboard pattern above? Which LEDs are turned on in the checkboard pattern above?
### Row, column - 1 ## Row, column - 1
Since the row and column numbers start at 0, an easy way to figure out the (x,y) coordinates Since the row and column numbers start at 0, an easy way to figure out the (x,y) coordinates
is to subtract 1 from the row and column number (when counting from 1). is to subtract 1 from the row and column number (when counting from 1).
In other words, to specify the LED in the 4th column 5th row, subtract 1 from each number to get coordinates `(3,4)`. In other words, to specify the LED in the 4th column 5th row, subtract 1 from each number to get coordinates `(3,4)`.
### Turn a LED on/off ## Turn a LED on/off
Use [plot](/reference/led/plot) and [unplot](/reference/led/unplot) to turn a LED on or off Use [plot](/reference/led/plot) and [unplot](/reference/led/unplot) to turn a LED on or off
@ -60,7 +60,7 @@ basic.pause(1000);
led.unplot(1,1); led.unplot(1,1);
``` ```
### Is a LED on/off? ## Is a LED on/off?
Use the [point](/reference/led/point) function to find out if a LED is on or off. Use the [point](/reference/led/point) function to find out if a LED is on or off.
@ -69,11 +69,11 @@ if(led.point(0,0)) {
} }
``` ```
### Display images, strings and numbers ## Display images, strings and numbers
Instead of turning individual LEDs on or off, as above, you can display an [image](/reference/images/image) directly to the screen or show text/numbers on screen using the [show number](/reference/basic/show-number)/[show string](/reference/basic/show-string) function. Instead of turning individual LEDs on or off, as above, you can display an [image](/reference/images/image) directly to the screen or show text/numbers on screen using the [show number](/reference/basic/show-number)/[show string](/reference/basic/show-string) function.
### The display buffer ## The display buffer
The micro:bit runtime keeps an in-memory representation of the state of all 25 LEDS. This state is known as the "display buffer" and controls which LEDS are on and which are off. The plot/unplot/point functions access the display buffer directly. On the other hand, the functions that show an image, number or string overwrite the buffer completely. To illustrate, first try running this code sequence The micro:bit runtime keeps an in-memory representation of the state of all 25 LEDS. This state is known as the "display buffer" and controls which LEDS are on and which are off. The plot/unplot/point functions access the display buffer directly. On the other hand, the functions that show an image, number or string overwrite the buffer completely. To illustrate, first try running this code sequence
@ -92,7 +92,7 @@ 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. 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 ## Pins: P3, P4, P6, P7, P9, P10
These pins are coupled to the LED matrix display, and also its associated ambient light sensing mode. 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). To disable the display driver feature (which will automatically disable the light sensing feature) use the function [led.enable](/reference/led/enable).

View File

@ -24,7 +24,6 @@ basic.forever(() => {
Unfortunately, using the serial library requires quite a bit of a setup. Unfortunately, using the serial library requires quite a bit of a setup.
### ~ hint ### ~ hint
**Windows earlier than 10** **Windows earlier than 10**
@ -34,7 +33,7 @@ If you are running a Windows version earlier than 10, you must install a device
* Follow the instructions at https://docs.mbed.com/docs/mbed-os-handbook/en/latest/getting_started/what_need/ to install the device driver. * Follow the instructions at https://docs.mbed.com/docs/mbed-os-handbook/en/latest/getting_started/what_need/ to install the device driver.
### ~ ## ~
### Chrome Extension ### Chrome Extension
@ -73,7 +72,7 @@ If you prefer another terminal emulator (such as [PuTTY](http://www.putty.org/))
![](/static/mb/serial-library-1.png) ![](/static/mb/serial-library-1.png)
### Linux ## Linux
* Install the program `screen` if it is not already installed. * Install the program `screen` if it is not already installed.
* Plug in the micro:bit. * Plug in the micro:bit.
@ -86,7 +85,7 @@ If you prefer another terminal emulator (such as [PuTTY](http://www.putty.org/))
Alternative programs include `minicom` and so on. Alternative programs include `minicom` and so on.
### Mac OS ## Mac OS
* Plug in the micro:bit * Plug in the micro:bit
* Open a terminal * Open a terminal

View File

@ -1,10 +1,10 @@
# Equipping a microservo with Crocodile clips # Equipping a microservo with Crocodile clips
### ~ hint ## ~ hint
If you are running a class or activity, you should consider preparing all servos before hand. If you are running a class or activity, you should consider preparing all servos before hand.
### ~ ## ~
## Using a microservo with the @boardname@ ## Using a microservo with the @boardname@
@ -20,7 +20,7 @@ and a **Male jumper (pig tail)** on the other end. You can purchase bundles of s
https://youtu.be/XtzsydSTXEg https://youtu.be/XtzsydSTXEg
### Materials ## Materials
* 1 Crocodile clip cable * 1 Crocodile clip cable
* 1 male (pig tail) cable * 1 male (pig tail) cable
@ -29,13 +29,13 @@ https://youtu.be/XtzsydSTXEg
Simple cut the cables, strip them, thread the cables together and cover with the shrink wrap. Simple cut the cables, strip them, thread the cables together and cover with the shrink wrap.
### ~ hint ## ~ hint
It is very **important** to ensure that there is a good connection between the 2 cables. 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 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.** **If you have access to a soldering iron, we strongly recommend to solder this connection.**
### ~ ## ~
## Direct connection ## Direct connection
@ -48,32 +48,32 @@ You can also connect your crocodile clips directly to the servo.
* 3 crocodile clips, yellow, red and black. * 3 crocodile clips, yellow, red and black.
* 1 micro servo 9g (SG90) * 1 micro servo 9g (SG90)
### Step 1: cutout the connector ## Step 1: cutout the connector
Using the cutting pliers, cut out the dark plastic connector. Using the cutting pliers, cut out the dark plastic connector.
![](/static/mb/projects/inchworm/servo1.jpg) ![](/static/mb/projects/inchworm/servo1.jpg)
### Step 2: strip out cables ## Step 2: strip out cables
Using the plier or a wire stripper, strip the plastic from the cables. Using the plier or a wire stripper, strip the plastic from the cables.
![](/static/mb/projects/inchworm/servotrim.jpg) ![](/static/mb/projects/inchworm/servotrim.jpg)
### Step 3: threading the servo cablers ## Step 3: threading the servo cablers
Thread the servo cables. Thread the servo cables.
![](/static/mb/projects/inchworm/servo3.jpg) ![](/static/mb/projects/inchworm/servo3.jpg)
### Step 4: crocobile clip ## Step 4: crocobile clip
Cut a crocodile cable in two and strip out the casing. Cut a crocodile cable in two and strip out the casing.
If possible try to use the same cable colors as the servo! If possible try to use the same cable colors as the servo!
![](/static/mb/projects/inchworm/servo4.jpg) ![](/static/mb/projects/inchworm/servo4.jpg)
### Step 5: thread cables together ## Step 5: thread cables together
Place the cables next to each other Place the cables next to each other
@ -83,27 +83,27 @@ Place the cables next to each other
![](/static/mb/projects/inchworm/servo6.jpg) ![](/static/mb/projects/inchworm/servo6.jpg)
### ~ hint ## ~ hint
It is very **important** to ensure that there is a good connection between the 2 cables. 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 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.** **If you have access to a soldering iron, we strongly recommend to solder this connection.**
### ~ ## ~
### Step 4: protect the connection ## Step 4: protect the connection
Protect the connection with shrinkwrap tubes, electrical or duct tape. Protect the connection with shrinkwrap tubes, electrical or duct tape.
![](/static/mb/projects/inchworm/servo7.jpg) ![](/static/mb/projects/inchworm/servo7.jpg)
### Step 5: repeat for all cables ## Step 5: repeat for all cables
Repeat the same process until all cables are connected. Repeat the same process until all cables are connected.
![](/static/mb/projects/inchworm/servo8.jpg) ![](/static/mb/projects/inchworm/servo8.jpg)
### Step 6: testing! ## 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**. It's time to test that your connection are all proper and that the servo will function **when the @boardname@ is powered by battery**.
@ -111,13 +111,13 @@ It's time to test that your connection are all proper and that the servo will fu
![](/static/mb/projects/inchworm/circuit1.jpg) ![](/static/mb/projects/inchworm/circuit1.jpg)
### ~ hint ## ~ hint
When attaching the crocodile clips to the pins, don't hesitate to grab the side of the board with the jaws. 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) ![](/static/mb/projects/inchworm/circuit2.jpg)
### ~ ## ~
* Download the following code to your @boardname@ * Download the following code to your @boardname@

View File

@ -16,21 +16,21 @@ The basic steps are:
Here are instructions for different browsers on Windows and Mac computers. Choose the one you're using: Here are instructions for different browsers on Windows and Mac computers. Choose the one you're using:
#### Windows browsers ### Windows browsers
* [Microsoft Edge](/device/usb/windows-edge) * [Microsoft Edge](/device/usb/windows-edge)
* [Internet Explorer](/device/usb/windows-ie) * [Internet Explorer](/device/usb/windows-ie)
* [Chrome](/device/usb/windows-chrome) * [Chrome](/device/usb/windows-chrome)
* [Firefox](/device/usb/windows-firefox) * [Firefox](/device/usb/windows-firefox)
#### Mac browsers ### Mac browsers
* [Safari](/device/usb/mac-safari) * [Safari](/device/usb/mac-safari)
* [Chrome](/device/usb/mac-chrome) * [Chrome](/device/usb/mac-chrome)
* [Firefox](/device/usb/mac-firefox) * [Firefox](/device/usb/mac-firefox)
### ~hint ## ~hint
Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting). Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting).
### ~ ## ~

View File

@ -62,8 +62,8 @@ flash memory on the micro:bit, which means even after you unplug the micro:bit,
your program will still run if the micro:bit is powered by battery. your program will still run if the micro:bit is powered by battery.
### ~hint ## ~hint
Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting). Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting).
### ~ ## ~

View File

@ -64,8 +64,8 @@ By copying the script onto the `MICROBIT` drive, you have programmed it into the
flash memory on the micro:bit, which means even after you unplug the micro:bit, flash memory on the micro:bit, which means even after you unplug the micro:bit,
your program will still run if the micro:bit is powered by battery. your program will still run if the micro:bit is powered by battery.
### ~hint ## ~hint
Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting). Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting).
### ~ ## ~

View File

@ -61,8 +61,8 @@ flash memory on the micro:bit, which means even after you unplug the micro:bit,
your program will still run if the micro:bit is powered by battery. your program will still run if the micro:bit is powered by battery.
### ~hint ## ~hint
Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting). Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting).
### ~ ## ~

View File

@ -53,7 +53,7 @@ You only need to do this once.
If the file was saved onto your computer, you will need to transfer it to the micro:bit. If the file was saved onto your computer, you will need to transfer it to the micro:bit.
### Manual transfer ## Manual transfer
Your `.hex` file (created in Step 3 above) appears as a download at the bottom of the browser. Your `.hex` file (created in Step 3 above) appears as a download at the bottom of the browser.
Click on the arrow next to the name of the file and then click **Show in folder**. Click on the arrow next to the name of the file and then click **Show in folder**.
@ -66,7 +66,7 @@ Alternatively, right-click on the hex file, choose **Send to**, and then **MICRO
![](/static/mb/device/usb-windows-sendto.jpg) ![](/static/mb/device/usb-windows-sendto.jpg)
### micro:bit uploader ## micro:bit uploader
You can use the [micro:bit uploader](/uploader) to automatically deploy ``.hex`` files to your micro:bit! You can use the [micro:bit uploader](/uploader) to automatically deploy ``.hex`` files to your micro:bit!
![](/static/uploader/tooltip.png) ![](/static/uploader/tooltip.png)
@ -82,8 +82,8 @@ You can use the [micro:bit uploader](/uploader) to automatically deploy ``.hex``
flash memory on the micro:bit, which means even after you unplug the micro:bit, flash memory on the micro:bit, which means even after you unplug the micro:bit,
your program will still run if the micro:bit is powered by battery. your program will still run if the micro:bit is powered by battery.
### ~hint ## ~hint
Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting). Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting).
### ~ ## ~

View File

@ -60,8 +60,8 @@ By copying the script onto the `MICROBIT` drive, you have programmed it into the
flash memory on the micro:bit, which means even after you unplug the micro:bit, flash memory on the micro:bit, which means even after you unplug the micro:bit,
your program will still run if the micro:bit is powered by battery. your program will still run if the micro:bit is powered by battery.
### ~hint ## ~hint
Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting). Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting).
### ~ ## ~

View File

@ -57,8 +57,8 @@ By copying the script onto the `MICROBIT` drive, you have programmed it into the
flash memory on the micro:bit, which means even after you unplug the micro:bit, flash memory on the micro:bit, which means even after you unplug the micro:bit,
your program will still run if the micro:bit is powered by battery. your program will still run if the micro:bit is powered by battery.
### ~hint ## ~hint
Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting). Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting).
### ~ ## ~

View File

@ -59,8 +59,8 @@ flash memory on the micro:bit, which means even after you unplug the micro:bit,
your program will still run if the micro:bit is powered by battery. your program will still run if the micro:bit is powered by battery.
### ~hint ## ~hint
Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting). Transfer not working? See some [troubleshooting tips](/device/usb/troubleshooting).
### ~ ## ~

View File

@ -1,31 +1,31 @@
# Documentation # Documentation
### @description Links to the documentation, reference and projects. ## @description Links to the documentation, reference and projects.
### Things to do ## Things to do
* [Projects](/projects) * [Projects](/projects)
* [Examples](/examples) * [Examples](/examples)
* [Courses](/courses) * [Courses](/courses)
* [Lessons](/lessons) * [Lessons](/lessons)
### @boardname@ reference ## @boardname@ reference
* [The @boardname@ APIs](/reference) * [The @boardname@ APIs](/reference)
* [The @boardname@ device](/device) * [The @boardname@ device](/device)
### Language and data reference ## Language and data reference
* [Blocks language](/blocks) * [Blocks language](/blocks)
* [JavaScript language](/javascript) * [JavaScript language](/javascript)
### More questions? ## More questions?
* [Frequently Asked Question](/faq) * [Frequently Asked Question](/faq)
* [Help Translate](/translate) * [Help Translate](/translate)
* [Embedding project](/share) * [Embedding project](/share)
### Developers ## Developers
* [Command Line Interface](/cli) * [Command Line Interface](/cli)
* Learn about [packages](/packages) * Learn about [packages](/packages)

View File

@ -1,10 +1,10 @@
# Lessons # Lessons
### @description Lessons to teach computer science and coding. ## @description Lessons to teach computer science and coding.
### @short Lessons ## @short Lessons
### ~column ## ~column
## Beginner ## Beginner
@ -22,9 +22,9 @@
* [Game Counter](/lessons/game-counter), displays the player's score with score and add points to score * [Game Counter](/lessons/game-counter), displays the player's score with score and add points to score
* [Happy Birthday](/lessons/happy-birthday), create a popular song * [Happy Birthday](/lessons/happy-birthday), create a popular song
### ~ ## ~
### ~column ## ~column
## Intermediate ## Intermediate
@ -45,9 +45,9 @@
* [Glowing Pendulum](/lessons/glowing-pendulum), construct a pendulum that glows using 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 * [Classic Beatbox](/lessons/classic-beatbox), make a beatbox music player with variables
### ~ ## ~
### ~column ## ~column
## Maker ## Maker
* [Pogo](/lessons/pogo), create a pogo game to test your jumping abilities * [Pogo](/lessons/pogo), create a pogo game to test your jumping abilities
@ -62,6 +62,6 @@
* [Headbands](/lessons/headbands), create a charades game with a collection of strings that hold the words * [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 @boardname@
* [Catch the Egg](/lessons/catch-the-egg-game), catch falling eggs in a basket with an acceleration controller * [Catch the Egg](/lessons/catch-the-egg-game), catch falling eggs in a basket with an acceleration controller
### ~ ## ~
### @section full ## @section full

View File

@ -2,12 +2,12 @@
Learn to create an answering machine on the @boardname@ Learn to create an answering machine on the @boardname@
### ~avatar avatar ## ~avatar avatar
Let's learn how to create an answering machine! Let's learn how to create an answering machine!
### ~ ## ~
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. 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.
@ -15,9 +15,9 @@ We will use `show string` to show text on the LED screen. *String* is a common n
basic.showString("ASK ME A QUESTION") basic.showString("ASK ME A QUESTION")
``` ```
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/answering-machine/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/answering-machine/challenges)!
### ~ ## ~

View File

@ -10,7 +10,7 @@ Complete the [answering machine](/lessons/answering-machine/activity) activity a
basic.showString("ASK ME A QUESTION") basic.showString("ASK ME A QUESTION")
``` ```
### Challenge 1 ## 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 @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`.
@ -23,7 +23,7 @@ input.onButtonPressed(Button.A, () => {
* `Run` the code to see if it works as expected. * `Run` the code to see if it works as expected.
### Challenge 2 ## 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 @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`.
@ -40,6 +40,6 @@ input.onButtonPressed(Button.B, () => {
* `Run` the code to see if it works as expected. * `Run` the code to see if it works as expected.
### Challenge 3 ## Challenge 3
When you are asked a yes or no question, do you always say yes or no? Add a condition for `on shake` that displays `MAYBE`. When you are asked a yes or no question, do you always say yes or no? Add a condition for `on shake` that displays `MAYBE`.

View File

@ -2,11 +2,11 @@
Generate and show a beautiful image. Generate and show a beautiful image.
### ~avatar avatar ## ~avatar avatar
Let's learn how to show an image on the LED screen. Let's learn how to show an image on the LED screen.
### ~ ## ~
We will use *show LEDs* to draw an image on the LED screen. This function immediately writes on the screen. We will use *show LEDs* to draw an image on the LED screen. This function immediately writes on the screen.
@ -20,9 +20,9 @@ basic.showLeds(`
`) `)
``` ```
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/beautiful-image/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/beautiful-image/challenges)!
### ~ ## ~

View File

@ -16,7 +16,7 @@ basic.showLeds(`
`) `)
``` ```
### Challenge 1 ## Challenge 1
Now show an new image that will display on the @boardname@. Now show an new image that will display on the @boardname@.
@ -39,7 +39,7 @@ basic.showLeds(`
* Does your code work as expected? * Does your code work as expected?
### Challenge 2 ## Challenge 2
Nice job! Why don't we create a third image that will show after the other two? Nice job! Why don't we create a third image that will show after the other two?

View File

@ -2,9 +2,9 @@
Beautiful Image tutorial. Beautiful Image tutorial.
### ~avatar avatar ## ~avatar avatar
### @video td/videos/beautiful-image-0 ## @video td/videos/beautiful-image-0
Rebuild the game! Rebuild the game!

View File

@ -2,7 +2,7 @@
Turn an LED on and off with forever Turn an LED on and off with forever
### ~avatar avatar ## ~avatar avatar
```sim ```sim
basic.forever(() => { basic.forever(() => {
@ -14,7 +14,7 @@ basic.forever(() => {
``` ```
Let's build a blinking light! Let's build a blinking light!
### ~ ## ~
Have you ever tried to blink a flashlight at night? The concept is fairly simply: turn on the light, wait for a little, turn off the light, wait again, and repeat. That's exactly what we need to code to get a blinking LED. Have you ever tried to blink a flashlight at night? The concept is fairly simply: turn on the light, wait for a little, turn off the light, wait again, and repeat. That's exactly what we need to code to get a blinking LED.
@ -53,9 +53,9 @@ basic.forever(() => {
}) })
``` ```
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/blink/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/blink/challenges)!
### ~ ## ~

View File

@ -15,7 +15,7 @@ basic.forever(() => {
}) })
``` ```
### Challenge 1 ## Challenge 1
Let's display a "smiley face" on the screen! We'll start by plotting the eyes. Let's display a "smiley face" on the screen! We'll start by plotting the eyes.
@ -34,7 +34,7 @@ basic.forever(() => {
}) })
``` ```
### Challenge 2 ## Challenge 2
Let's add the code to plot the mouth by using `plot` and `unplot` to the following coordinates: (1,4), (2,4) and (3,4). When you're ready, don't forget to run your code to try it out! Let's add the code to plot the mouth by using `plot` and `unplot` to the following coordinates: (1,4), (2,4) and (3,4). When you're ready, don't forget to run your code to try it out!
@ -57,7 +57,7 @@ basic.forever(() => {
}) })
``` ```
### Challenge 3 ## Challenge 3
Let's keep using `plot` to convert the mouth into a smiley face. Let's keep using `plot` to convert the mouth into a smiley face.
@ -69,11 +69,11 @@ Let's keep using `plot` to convert the mouth into a smiley face.
0 1 1 1 0 0 1 1 1 0
```` ````
### Challenge 4 ## Challenge 4
Let's make it blink a bit faster. To do so, we need to reduce the amount of time used in ``pause`` to 100 milliseconds. Let's make it blink a bit faster. To do so, we need to reduce the amount of time used in ``pause`` to 100 milliseconds.
### Challenge 5 ## Challenge 5
Create your own image by changing the coordinates in `plot` and `unplot`! Create your own image by changing the coordinates in `plot` and `unplot`!

View File

@ -28,7 +28,7 @@ basic.forever(() => {
Again, test the code in the simulator. Try clicking **Button A** to display the "hello, world!" message every time the `button is pressed`. Again, test the code in the simulator. Try clicking **Button A** to display the "hello, world!" message every time the `button is pressed`.
### More 'if' statements ## More 'if' statements
You could now add additional conditions to your 'if statement'. Here are some ideas: You could now add additional conditions to your 'if statement'. Here are some ideas:

View File

@ -34,7 +34,7 @@ input.onButtonPressed(Button.B, () => {
}) })
``` ```
### Challenge 1 ## Challenge 1
Now let's add some more types of instructions for the player to follow. Let's add `PRESS PIN 0`. Now let's add some more types of instructions for the player to follow. Let's add `PRESS PIN 0`.
Change the global variable `action` to `math->random(4)` so that we can add a new **IF** statement that checks if `action=3`. If it does, display instructions to press pin 0. Change the global variable `action` to `math->random(4)` so that we can add a new **IF** statement that checks if `action=3`. If it does, display instructions to press pin 0.
@ -58,7 +58,7 @@ export function newAction() {
} }
``` ```
### Challenge 2 ## Challenge 2
Now let's implement `PRESS PIN 0` in the main. Create a condition of `input->on pin pressed("P0")` that will add one to the score and calls the method `new action`. Now let's implement `PRESS PIN 0` in the main. Create a condition of `input->on pin pressed("P0")` that will add one to the score and calls the method `new action`.
@ -80,7 +80,7 @@ input.onPinPressed(TouchPin.P0, () => {
}) })
``` ```
### Challenge 3 ## Challenge 3
Add `POINT ME NORTH` to the list of possible commands. Add `POINT ME NORTH` to the list of possible commands.

View File

@ -10,29 +10,29 @@ Use this activity document to guide your work in the [bop it activity](/lessons/
Answer the questions while completing the tutorial. Pay attention to the dialogues! Answer the questions while completing the tutorial. Pay attention to the dialogues!
### 1. Write the code that will store the global variable named 'action' and returns a random number between 0 and 2 ## 1. Write the code that will store the global variable named 'action' and returns a random number between 0 and 2
<br/> <br/>
### 2. Write the code that will display the string, "PUSH A" if the global variable called 'action' is equal to 0 ## 2. Write the code that will display the string, "PUSH A" if the global variable called 'action' is equal to 0
<br /> <br />
### 3. Write the code that increments the score if button A is pressed when the global variable called 'action' is equal to 1 ## 3. Write the code that increments the score if button A is pressed when the global variable called 'action' is equal to 1
<br /> <br />
### 4. Write the code that will display the string "LOGO DOWN" if the global variable called 'action' is equal to 1 ## 4. Write the code that will display the string "LOGO DOWN" if the global variable called 'action' is equal to 1
<br /> <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 @boardname@ logo is tilted down when the global variable called 'action' is equal to 1
<br /> <br />
### 6. Write the code that will display the string "SHAKE" if the global variable called 'action' is equal to 2 ## 6. Write the code that will display the string "SHAKE" if the global variable called 'action' is equal to 2
<br /> <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 @boardname@ is shaken when the global variable called 'action' is equal to 2

View File

@ -25,15 +25,15 @@ basic.forever(() => {
}) })
``` ```
### ~avatar avatar impressed ## ~avatar avatar impressed
### Challenge 1 ## Challenge 1
Let's use an **IF** statement to detect if the egg and the basket are lined up. Let's use an **IF** statement to detect if the egg and the basket are lined up.
Now that we know when an egg is caught, we can keep track of the score! We need to use the `add score` function built into the game library to add `1` point for every egg that is caught. However, let's not forget to `remove life` if an egg falls off the display before it's caught! Now that we know when an egg is caught, we can keep track of the score! We need to use the `add score` function built into the game library to add `1` point for every egg that is caught. However, let's not forget to `remove life` if an egg falls off the display before it's caught!
### ~ ## ~
```blocks ```blocks
let basketX1 = 2 let basketX1 = 2
@ -65,13 +65,13 @@ basic.forever(() => {
* Press the `run` button to test out your game. * Press the `run` button to test out your game.
### ~avatar avatar encourage ## ~avatar avatar encourage
### Challenge 2 ## Challenge 2
Catching eggs gets easier with practice so let's make the eggs fall faster every 5 catches. We can do this by tracking how long the egg pauses in each position while falling with a global variable called **falling pause**. Let's create this variable and set it to `300` initially. Don't forget to also create a condition that will be true every 5 catches. Catching eggs gets easier with practice so let's make the eggs fall faster every 5 catches. We can do this by tracking how long the egg pauses in each position while falling with a global variable called **falling pause**. Let's create this variable and set it to `300` initially. Don't forget to also create a condition that will be true every 5 catches.
### ~ ## ~
```blocks ```blocks
let basketX2 = 2 let basketX2 = 2
@ -104,9 +104,9 @@ basic.forever(() => {
}) })
``` ```
### ~avatar avatar surprised ## ~avatar avatar surprised
### Challenge 3 ## Challenge 3
Let's make the egg fall faster by decreasing the amount of time it pauses in each position by decreasing **falling pause** by `25` every 5 catches. Now, instead of pausing for 300 milliseconds we can pause for the value of **falling pause**. Let's make the egg fall faster by decreasing the amount of time it pauses in each position by decreasing **falling pause** by `25` every 5 catches. Now, instead of pausing for 300 milliseconds we can pause for the value of **falling pause**.

View File

@ -1,6 +1,6 @@
# catch the egg game tutorial # catch the egg game tutorial
### Rebuild the game! ## Rebuild the game!
The blocks have been shuffled! Put them back together so that... The blocks have been shuffled! Put them back together so that...
* an egg LED falls from the top of the screen, row by row. * an egg LED falls from the top of the screen, row by row.

View File

@ -2,12 +2,12 @@
Measure the acceleration on the @boardname@ in the "x" direction. Measure the acceleration on the @boardname@ in the "x" direction.
### ~avatar avatar ## ~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 @boardname@ to chart the acceleration in the "x" direction. Let's get started!
### ~ ## ~
Let's measure `acceleration (mg)` in the "x" direction. Get the acceleration value (milli g-force), in one of three specified dimensions. Let's measure `acceleration (mg)` in the "x" direction. Get the acceleration value (milli g-force), in one of three specified dimensions.
@ -15,7 +15,7 @@ Let's measure `acceleration (mg)` in the "x" direction. Get the acceleration val
input.acceleration(Dimension.X) 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 @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 ```blocks
@ -25,25 +25,25 @@ 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 @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 @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 @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) ![](/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 @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. 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 @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 @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 @boardname@
@ -60,9 +60,9 @@ Use the Recommended Charts command on the Insert tab to quickly create a chart t
* On the Recommended Charts tab, scroll through the list of chart types that Excel recommends for your data. Pick the **scatter plot**. * On the Recommended Charts tab, scroll through the list of chart types that Excel recommends for your data. Pick the **scatter plot**.
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/charting/challenge) Excellent, you're ready to continue with the [challenges](/lessons/charting/challenge)
### ~ ## ~

View File

@ -1,17 +1,17 @@
# 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 @boardname@ and to visualize the acceleration on the 2nd @boardname@.
Let's get started! 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 @boardname@s connected via radio.
```blocks ```blocks
radio.sendNumber(input.acceleration(Dimension.X)); radio.sendNumber(input.acceleration(Dimension.X));
``` ```
### ~ ## ~
We want to display the acceleration forever. In order to do so, we need a `forever` loop. A forever loop will repeat code in the background forever. We want to display the acceleration forever. In order to do so, we need a `forever` loop. A forever loop will repeat code in the background forever.
```blocks ```blocks
@ -21,7 +21,7 @@ basic.forever(() => {
``` ```
### ~ ## ~
We want to register code to run when a packet is received over radio. We can implement this code by adding `on data received`. We want to register code to run when a packet is received over radio. We can implement this code by adding `on data received`.
```blocks ```blocks
@ -32,7 +32,7 @@ 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 @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 @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 ```blocks
@ -44,20 +44,20 @@ radio.onDataPacketReceived(({ receivedNumber }) => {
}) })
``` ```
### ~ ## ~
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 @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) ![](/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 @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 @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 @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) ![](/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) ![](/static/mb/data3.png)
@ -78,7 +78,7 @@ Use the Recommended Charts command on the Insert tab to quickly create a chart t
![](/static/mb/elements_styles_filters.png) ![](/static/mb/elements_styles_filters.png)
### ~ ## ~
Have fun reviewing your simulation and analyze the acceleration by chart the Excel data using Excel. 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 first @boardname@ to your computer using your USB cable and run the charting script on it.

View File

@ -47,8 +47,8 @@ input.onPinPressed(TouchPin.P1, () => {
* click *run* to see if the code works as expected. * click *run* to see if the code works as expected.
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/classic-beatbox/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/classic-beatbox/challenges)!
### ~ ## ~

View File

@ -17,7 +17,7 @@ input.onPinPressed(TouchPin.P1, () => {
}) })
``` ```
### Challenge 1 ## Challenge 1
Let's include a second sound `on pin pressed` *P2*. To do this, you need to add the same blocks as the banana keyboard activity. However, you must change alter `on pin pressed` from P1 to P2. Additionally, you must *decrease* the frequency of the variable "sound" by 25. Modify your code so that your code looks like this Let's include a second sound `on pin pressed` *P2*. To do this, you need to add the same blocks as the banana keyboard activity. However, you must change alter `on pin pressed` from P1 to P2. Additionally, you must *decrease* the frequency of the variable "sound" by 25. Modify your code so that your code looks like this
@ -42,7 +42,7 @@ input.onPinPressed(TouchPin.P2, () => {
* click *run* to see if the code works as expected. * click *run* to see if the code works as expected.
### Challenge 2 ## Challenge 2
Finally, we want images to be displayed with sounds `on pin pressed`. Add `show LEDs` blocks under `on pin pressed` P1 and P2. Finally, we want images to be displayed with sounds `on pin pressed`. Add `show LEDs` blocks under `on pin pressed` P1 and P2.

View File

@ -2,11 +2,11 @@
Display the direction that the @boardname@ is facing using the compass Display the direction that the @boardname@ is facing using the compass
### ~avatar avatar ## ~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 @boardname@ is pointing. Let's get started!
### ~ ## ~
Create a loop that will continuously update the reading of the compass. Create a loop that will continuously update the reading of the compass.
@ -90,9 +90,9 @@ basic.forever(() => {
}); });
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/compass/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/compass/challenges)!
### ~ ## ~

View File

@ -24,7 +24,7 @@ basic.forever(() => {
}); });
``` ```
### Challenge 1 ## 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 @boardname@ is pointing North, display a star to indicate the north star.
@ -54,7 +54,7 @@ basic.forever(() => {
* Run your code to see if it works as expected * Run your code to see if it works as expected
### Challenge 2 ## Challenge 2
Instead of displaying just `N`, `W`, `S`, or `E`, display the full word. Instead of displaying just `N`, `W`, `S`, or `E`, display the full word.
@ -79,7 +79,7 @@ basic.forever(() => {
* Run your code to see if it works as expected * Run your code to see if it works as expected
### Challenge 3 ## Challenge 3
Display your own unique message for each direction. Display your own unique message for each direction.

View File

@ -1,6 +1,6 @@
# counter lesson # Counter lesson
Learn how to create a counter with with on button pressed. Learn how to create a counter with with **on button** pressed.
## Topic ## Topic
@ -13,9 +13,9 @@ Variables
* [quiz](/lessons/counter/quiz) * [quiz](/lessons/counter/quiz)
* [quiz answers](/lessons/counter/quiz-answers) * [quiz answers](/lessons/counter/quiz-answers)
## Prior learning/place of lesson in scheme of work ## Prior learning and lesson level
Learn how to creating a **variable** to keep track of the current count. We will be learning how to create a counter app using a variable as well as simple commands, such as on button pressed, and show number. Learn how to create a **variable** to keep track of the current count. We will be learning how to create a counter app using a variable and simple commands, such as on button pressed, and show number.
## Documentation ## Documentation
@ -34,10 +34,10 @@ basic.showLeds(`
`) `)
``` ```
* **variable**: [read more...](/blocks/variables) * **[variable](/blocks/variables)**:
* **arithmetic operators**: [read more...](/types/number) * **[arithmetic operators](/types/number)**
* **on button pressed** : [read more...](/reference/input/on-button-pressed) * **[on button pressed](/reference/input/on-button-pressed)**
* **show number** : [read more...](/reference/basic/show-number) * **[show number](/reference/basic/show-number)**
## Objectives ## Objectives

View File

@ -2,11 +2,11 @@
Display a number with a variable. Display a number with a variable.
### ~avatar avatar ## ~avatar avatar
Welcome! This tutorial will teach you how to make a counter that increments when button A is pressed. Let's get started! Welcome! This tutorial will teach you how to make a counter that increments when button A is pressed. Let's get started!
### ~ ## ~
Let's start by creating a **local variable** `count` to keep track of the current count. Let's start by creating a **local variable** `count` to keep track of the current count.
@ -35,9 +35,9 @@ input.onButtonPressed(Button.A, () => {
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/counter/challenges) Excellent, you're ready to continue with the [challenges](/lessons/counter/challenges)
### ~ ## ~

View File

@ -14,7 +14,7 @@ input.onButtonPressed(Button.A, () => {
}) })
``` ```
### Challenge 1 ## Challenge 1
Let's add the code to `count` when `B` is pressed. Add an event handler with `on button pressed(B)` then add the code to `count`. Let's add the code to `count` when `B` is pressed. Add an event handler with `on button pressed(B)` then add the code to `count`.
@ -31,7 +31,7 @@ input.onButtonPressed(Button.B, () => {
}) })
``` ```
### Challenge 3 ## 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 @boardname@ is shaken. You will need to register an event handler with `on shake`.

View File

@ -2,11 +2,11 @@
Create a dice on the @boardname@ Create a dice on the @boardname@
### ~avatar avatar ## ~avatar avatar
Welcome! This tutorial will help you create a dice. Let's get started! 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 @boardname@ is shaken.
@ -161,9 +161,9 @@ input.onGesture(Gesture.Shake, () => {
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/dice-roll/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/dice-roll/challenges)!
### ~ ## ~

View File

@ -60,7 +60,7 @@ input.onGesture(Gesture.Shake, () => {
}); });
``` ```
### Challenge 1 ## Challenge 1
Modify the line of code with `pick random` so that only number 1-4 can appear on the dice. Modify the line of code with `pick random` so that only number 1-4 can appear on the dice.
@ -119,7 +119,7 @@ input.onGesture(Gesture.Shake, () => {
}); });
``` ```
### Challenge 2 ## 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 @boardname@.
@ -177,7 +177,7 @@ input.onGesture(Gesture.Shake, () => {
}); });
``` ```
### Challenge 3 ## 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 @boardname@ randomly chooses a number between 1 and 8.

View File

@ -2,11 +2,11 @@
Create a counter with a while loop. Create a counter with a while loop.
### ~avatar avatar ## ~avatar avatar
Welcome! This tutorial will teach how to create a counter with a while loop. Let's get started! Welcome! This tutorial will teach how to create a counter with a while loop. Let's get started!
### ~ ## ~
Create a variable that acts as a counter and set it to 0. Create a variable that acts as a counter and set it to 0.
@ -50,9 +50,9 @@ while (count < 10) {
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/digi-yoyo/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/digi-yoyo/challenges)!
### ~ ## ~

View File

@ -17,7 +17,7 @@ while (count < 10) {
} }
``` ```
### Challenge 1 ## Challenge 1
How about we create a counter that counts backwards from 10 to 1? Let's add a while loop that executes only when `count` is greater than 0. How about we create a counter that counts backwards from 10 to 1? Let's add a while loop that executes only when `count` is greater than 0.
@ -38,7 +38,7 @@ while (count > 0) {
``` ```
### Challenge 2 ## Challenge 2
Inside of the while loop, let's add `pause->(1000)` so that we have a pause between each number as it's counting down. Also, let's show `count`! Inside of the while loop, let's add `pause->(1000)` so that we have a pause between each number as it's counting down. Also, let's show `count`!
@ -60,7 +60,7 @@ while (count > 0) {
* Run the code to see if it works as expected. * Run the code to see if it works as expected.
### Challenge 3 ## 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 @boardname@ has displayed the value of `count`.

View File

@ -2,11 +2,11 @@
Control images with a variable. Control images with a variable.
### ~avatar avatar ## ~avatar avatar
In this activity, you will learn how to blink an image on the LED screen. 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 @boardname@.
@ -63,9 +63,9 @@ basic.forever(() => {
``` ```
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/flashing-heart/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/flashing-heart/challenges)!
### ~ ## ~

View File

@ -23,7 +23,7 @@ basic.forever(() => {
``` ```
### Challenge 1 ## Challenge 1
Let's plot a different image. Let's display a broken heart! Let's plot a different image. Let's display a broken heart!
@ -56,7 +56,7 @@ basic.forever(() => {
* click *run main* to see if the code works as expected. * click *run main* to see if the code works as expected.
### Challenge 2 ## Challenge 2
Now let's alternate flashing the heart and the broken heart. To do this, we need to add a `clear screen` block and then add a `pause` block of 500 milliseconds under the new code we added in Challenge 1. Now let's alternate flashing the heart and the broken heart. To do this, we need to add a `clear screen` block and then add a `pause` block of 500 milliseconds under the new code we added in Challenge 1.
@ -90,7 +90,7 @@ basic.forever(() => {
* click *run main* to see if the code works as expected. * click *run main* to see if the code works as expected.
### Challenge 3 ## Challenge 3
You now have a heart and broken heart flashing! Now plot a new image to alternate in with the heart and broken heart. You now have a heart and broken heart flashing! Now plot a new image to alternate in with the heart and broken heart.

View File

@ -24,9 +24,9 @@ input.onButtonPressed(Button.A, () => {
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/game-counter/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/game-counter/challenges)!
### ~ ## ~

View File

@ -13,7 +13,7 @@ input.onButtonPressed(Button.A, () => {
}); });
``` ```
### Challenge 1 ## Challenge 1
Let's add the code to `score` when `B` is pressed. Add an event handler with `on button (B) pressed` then add the code to `score`. Let's add the code to `score` when `B` is pressed. Add an event handler with `on button (B) pressed` then add the code to `score`.
@ -31,7 +31,7 @@ input.onButtonPressed(Button.B, () => {
``` ```
### Challenge 3 ## 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 @boardname@ is shaken. You will need to register an event handler with `on shake`.

View File

@ -8,9 +8,9 @@ We will use `show string` to show text on the LED screen. *String* is a common n
basic.showString("SELECT A BUTTON") basic.showString("SELECT A BUTTON")
``` ```
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/game-of-chance/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/game-of-chance/challenges)!
### ~ ## ~

View File

@ -11,7 +11,7 @@ basic.showString("SELECT A BUTTON")
``` ```
### Challenge 1 ## Challenge 1
Now we need to to play the game of chance by responding to the message. We want to respond `YOU WIN` when button `A` is pressed. Add a condition for button `A` and inside it show the string `YOU WIN`. Now we need to to play the game of chance by responding to the message. We want to respond `YOU WIN` when button `A` is pressed. Add a condition for button `A` and inside it show the string `YOU WIN`.
@ -26,7 +26,7 @@ input.onButtonPressed(Button.A, () => {
* `Run` the code to see if it works as expected. * `Run` the code to see if it works as expected.
### Challenge 2 ## 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 @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`.
@ -42,7 +42,7 @@ input.onButtonPressed(Button.B, () => {
* `Run` the code to see if it works as expected. * `Run` the code to see if it works as expected.
### Challenge 3 ## Challenge 3
When you are asked a yes or no question, do you always say yes or no? Add a condition for `on shake` that displays `TRY AGAIN`. When you are asked a yes or no question, do you always say yes or no? Add a condition for `on shake` that displays `TRY AGAIN`.

View File

@ -100,9 +100,9 @@ basic.forever(() => {
}); });
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/glowing-pendulum/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/glowing-pendulum/challenges)!
### ~ ## ~

View File

@ -24,13 +24,13 @@ basic.forever(() => {
``` ```
### Challenge 1 ## Challenge 1
![](/static/mb/lessons/glowing-pendulum-0.jpg) ![](/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 @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 ## 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 @boardname@ to measure the force in a different direction. What differences in the resulting pattern does this replacement make?

View File

@ -2,7 +2,7 @@
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 @boardname@.
### Rebuild the game! ## Rebuild the game!
The blocks have been shuffled! Put them back together so that... The blocks have been shuffled! Put them back together so that...
* all LEDs are turned on * all LEDs are turned on

View File

@ -14,13 +14,13 @@ 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. 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.
### Pixel Art ## Pixel Art
We can draw little images from the LEDs by ticking boxes. Drag a `show image` block from the **Images** drawer and connect in a `create image` block. You can customize this image by clicking boxes to tick whether the LED will turn on or off. For example, if we were creating a music player we may want to the show the `play` block: We can draw little images from the LEDs by ticking boxes. Drag a `show image` block from the **Images** drawer and connect in a `create image` block. You can customize this image by clicking boxes to tick whether the LED will turn on or off. For example, if we were creating a music player we may want to the show the `play` block:
![](/static/mb/blocks/lessons/graphics-0.png) ![](/static/mb/blocks/lessons/graphics-0.png)
### Plotting points ## 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 @boardname@.
@ -41,7 +41,7 @@ We can also use the `basic.clearScreen` block to turn off all LEDs.
The pause block is in milliseconds, so setting it to 1000 will have a pause of a single second. The pause block is in milliseconds, so setting it to 1000 will have a pause of a single second.
### Devising algorithms for shapes ## 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 @boardname@ using an algorithm.
For example, we could draw a straight line with this code: For example, we could draw a straight line with this code:
@ -66,13 +66,13 @@ basic.forever(() => {
}) })
``` ```
### Animations ## Animations
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). 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 @boardname@ display an explosion or fireworks.
### Image variables ## Image variables
We can create image variables so we can easily display an image at a later point. For example: We can create image variables so we can easily display an image at a later point. For example:

View File

@ -2,11 +2,11 @@
Guess the number with math random. Guess the number with math random.
### ~avatar avatar ## ~avatar avatar
Welcome! This tutorial will help you create a guess the number game! Let's get started! Welcome! This tutorial will help you create a guess the number game! Let's get started!
### ~ ## ~
Add an event handler when button `A` is pressed. Add an event handler when button `A` is pressed.
@ -37,9 +37,9 @@ input.onButtonPressed(Button.A, () => {
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/guess-the-number/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/guess-the-number/challenges)!
### ~ ## ~

View File

@ -13,7 +13,7 @@ input.onButtonPressed(Button.A, () => {
}) })
``` ```
### Challenge 1 ## Challenge 1
When button `B` is pressed, we want to clear the screen. This will make it so users can play your game over and over again! Add an event handler to handle this case. When button `B` is pressed, we want to clear the screen. This will make it so users can play your game over and over again! Add an event handler to handle this case.
@ -27,7 +27,7 @@ input.onButtonPressed(Button.B, () => {
}) })
``` ```
### Challenge 2 ## Challenge 2
Show an animation when you clear the screen! Choose what animation makes most sense to you. Be creative! Show an animation when you clear the screen! Choose what animation makes most sense to you. Be creative!

View File

@ -1,12 +1,12 @@
# guess the number tutorial # guess the number tutorial
### ~avatar avatar ## ~avatar avatar
This tutorial will help you create a guess the number game! Let's get started! This tutorial will help you create a guess the number game! Let's get started!
### ~ ## ~
### Rebuild the game! ## Rebuild the game!
The blocks have been shuffled! Put them back together so that... The blocks have been shuffled! Put them back together so that...
* when the user presses button ``A``, * when the user presses button ``A``,

View File

@ -48,9 +48,9 @@ basic.pause(100);
* click run to see if the code works as expected. * click run to see if the code works as expected.
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/happy-birthday/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/happy-birthday/challenges)!
### ~ ## ~

View File

@ -26,9 +26,9 @@ basic.pause(100);
``` ```
### ~ ## ~
### Challenge 1 ## Challenge 1
Let's code the third part of Happy Birthday! Let's code the third part of Happy Birthday!
@ -60,7 +60,7 @@ basic.pause(100);
* click *run * to see if the code works as expected. * click *run * to see if the code works as expected.
### Challenge 2 ## Challenge 2
Finally, we continue to adding the appropriate `play` block and fit the following chords blocks `F`, `E`, `C`, `D` to complete the third part of the song. Modify your code so that your code looks like this. Finally, we continue to adding the appropriate `play` block and fit the following chords blocks `F`, `E`, `C`, `D` to complete the third part of the song. Modify your code so that your code looks like this.
@ -98,7 +98,7 @@ music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
* click *run * to see if the code works as expected. * click *run * to see if the code works as expected.
### Challenge 3 ## Challenge 3
You now have a the ability to create music on the @boardname@. 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

@ -1,6 +1,6 @@
# headbands lesson # Headband lesson
create a charades game that can be played with your friends. Create a charades game to play with your friends.
## Topic ## Topic
@ -42,13 +42,13 @@ Learn how to create a charades game with **collections**, ` create -> Collection
## Documentation ## Documentation
* **collection** * **collection**
* **variables** : [read more...](/blocks/variables) * **[variables](/blocks/variables)**
* **Boolean** : [read more...](/blocks/logic/boolean) * **[Boolean](/blocks/logic/boolean)**
* **on logo up** [read more...](/reference/input/on-gesture) * **[on logo up](/reference/input/on-gesture)**
* **on screen down** [read more...](/reference/input/on-gesture) * **[on screen down](/reference/input/on-gesture)**
* **on screen up** [read more...](/reference/input/on-gesture) * **[on screen up](/reference/input/on-gesture)**
* **show string** : [read more...](/reference/basic/show-string) * **[show string](/reference/basic/show-string)**
* **game library** : [read more...](/reference/game) * **[game library](/reference/game)**
## Resources ## Resources
@ -70,14 +70,14 @@ Learn how to create a charades game with **collections**, ` create -> Collection
## Progression Pathways / Computational Thinking Framework ## Progression Pathways / Computational Thinking Framework
#### Algorithms ### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL) * Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL) * Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Recognises that different solutions exist for the same problem (AL) (AB) Understands that iteration is the repetition of a process such as a loop (AL) * Recognises that different solutions exist for the same problem (AL) (AB) Understands that iteration is the repetition of a process such as a loop (AL)
* Represents solutions using a structured notation (AL) (AB) * Represents solutions using a structured notation (AL) (AB)
#### Programming & Development ### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL) * Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB) * Declares and assigns variables(AB)
@ -87,20 +87,20 @@ Learn how to create a charades game with **collections**, ` create -> Collection
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL) * Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB * Selects the appropriate data types(AL) (AB
#### Data & Data Representation ### Data & Data Representation
* Understands the difference between data and information(AB) * Understands the difference between data and information(AB)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV) * Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
#### Hardware & Processing ### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB) * Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Communication Networks ### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL) * Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology ### Information Technology
* Collects, organizes, and presents data and information in digital content (AB) * Collects, organizes, and presents data and information in digital content (AB)
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV) * Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV)

View File

@ -22,7 +22,7 @@ input.onScreenDown(() => {
game.startCountdown(30000) game.startCountdown(30000)
``` ```
### Challenge 1 ## Challenge 1
Let's add more words for the player to act out! But first, we need to increase the time in one round to give the player more time get through all the words. Let's change the `game->start countdown` statement. Let's add more words for the player to act out! But first, we need to increase the time in one round to give the player more time get through all the words. Let's change the `game->start countdown` statement.
@ -47,7 +47,7 @@ game.startCountdown(60000)
* Run your code to see if it works as expected * Run your code to see if it works as expected
### Challenge 2 ## Challenge 2
Now let's add 5 more words to our list of charade words. Right above the the line `word:=coll->at(index)` add 5 lines that say `coll->add("")`. In this example, we will add the words **bicycle, telephone, sun, car, and ant** but you can add whatever words you like. Now let's add 5 more words to our list of charade words. Right above the the line `word:=coll->at(index)` add 5 lines that say `coll->add("")`. In this example, we will add the words **bicycle, telephone, sun, car, and ant** but you can add whatever words you like.
@ -76,15 +76,15 @@ game.startCountdown(30000)
* Run your code to see if it works as expected. * Run your code to see if it works as expected.
### Challenge 3 ## Challenge 3
Remove a life using `game->remove life` when the screen is down using the `input->on screen down` event. Remove a life using `game->remove life` when the screen is down using the `input->on screen down` event.
### Challenge 4 ## Challenge 4
The collection has a function `random` that returns a random element. Update your code to use this function instead of using `math->random`. The collection has a function `random` that returns a random element. Update your code to use this function instead of using `math->random`.
### Challenge 5! ## Challenge 5!
Play the game and try guessing all these words in less than 2 minutes! Play the game and try guessing all these words in less than 2 minutes!

View File

@ -2,11 +2,11 @@
A classic game, Hero, in which you must capture the food and flee away from the ghost! A classic game, Hero, in which you must capture the food and flee away from the ghost!
### ~avatar avatar ## ~avatar avatar
This tutorial will teach you how to create a hero game to capture food while dodging the ghost; the game was inspired by the classic arcade game Pac Man. This tutorial will teach you how to create a hero game to capture food while dodging the ghost; the game was inspired by the classic arcade game Pac Man.
### ~ ## ~
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. 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.
@ -270,9 +270,9 @@ ghost.set(LedSpriteProperty.X, 4);
``` ```
### ~avatar avatar ## ~avatar avatar
Congratulations! You have a homemade hero game based on the classic version of PacMan Congratulations! You have a homemade hero game based on the classic version of PacMan
### ~ ## ~

View File

@ -28,9 +28,9 @@ for (let i = 0; i < 6; i++) {
} }
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/looper/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/looper/challenges)!
### ~ ## ~

View File

@ -18,7 +18,7 @@ for (let i = 0; i < 6; i++) {
} }
``` ```
### Challenge 1 ## Challenge 1
What if we want to count up to lucky number 7 instead? Let's do that by changing the ending value to `7` instead of `5`. What if we want to count up to lucky number 7 instead? Let's do that by changing the ending value to `7` instead of `5`.
@ -33,7 +33,7 @@ for (let i = 0; i < 8; i++) {
* Run the program now to see your changes. * Run the program now to see your changes.
### Challenge 2 ## Challenge 2
What about 9? Let's do that by changing the ending value to `9`. What about 9? Let's do that by changing the ending value to `9`.
@ -49,7 +49,7 @@ for (let i = 0; i < 10; i++) {
* Run your code to see the new counter. * Run your code to see the new counter.
### Challenge 3 ## Challenge 3
Now let's start counting from `3` instead! Our for loop will always start at `0` so we simply add `3` to the `i` variable when passing it to `show number`. Now let's start counting from `3` instead! Our for loop will always start at `0` so we simply add `3` to the `i` variable when passing it to `show number`.
@ -64,7 +64,7 @@ for (let i = 0; i < 10; i++) {
Run it on the simulator! Run it on the simulator!
### Challenge 4 ## Challenge 4
Now, let's **count down from 9**. Change the line `show number(i + 2, 150)` to `show number(9 - i, 150)`. Now, let's **count down from 9**. Change the line `show number(i + 2, 150)` to `show number(9 - i, 150)`.
@ -79,7 +79,7 @@ for (let i = 0; i < 10; i++) {
* Run the code to make sure it is doing what is expected. * Run the code to make sure it is doing what is expected.
### Challenge 5 ## Challenge 5
After counting down from `9` let's show the string `BOOOM`! After counting down from `9` let's show the string `BOOOM`!

View File

@ -2,11 +2,11 @@
Create a love meter with the @boardname@ Create a love meter with the @boardname@
### ~avatar avatar ## ~avatar avatar
Welcome! This activity will help you create a love meter with the @boardname@. Let's get started! Welcome! This activity will help you create a love meter with the @boardname@. Let's get started!
### ~ ## ~
Begin by registering an event with `on pin pressed` *P0* to know when someone is holding pin *P0* and pin *Gnd*. Begin by registering an event with `on pin pressed` *P0* to know when someone is holding pin *P0* and pin *Gnd*.
@ -39,9 +39,9 @@ input.onPinPressed(TouchPin.P0, () => {
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/love-meter/challenges) Excellent, you're ready to continue with the [challenges](/lessons/love-meter/challenges)
### ~ ## ~

View File

@ -14,7 +14,7 @@ input.onPinPressed(TouchPin.P0, () => {
``` ```
### Challenge 1 ## Challenge 1
Add a pause of 3000 milliseconds (3 seconds) after showing the number so that the number won't immediately disappear in the next challenge. Add a pause of 3000 milliseconds (3 seconds) after showing the number so that the number won't immediately disappear in the next challenge.
@ -27,7 +27,7 @@ input.onPinPressed(TouchPin.P0, () => {
}) })
``` ```
### Challenge 2 ## Challenge 2
If the rating **x** is between *0* and *3* (strictly less than *4*), display the text "HORRIBLE!". If the rating **x** is between *0* and *3* (strictly less than *4*), display the text "HORRIBLE!".
@ -43,7 +43,7 @@ input.onPinPressed(TouchPin.P0, () => {
}) })
``` ```
### Challenge 3 ## Challenge 3
**If** the rating is between 4 and 7, display the text "MEDIOCRE!" **else** display the text "MATCHED!" **If** the rating is between 4 and 7, display the text "MEDIOCRE!" **else** display the text "MATCHED!"
@ -63,7 +63,7 @@ input.onPinPressed(TouchPin.P0, () => {
}) })
``` ```
### Challenge 4 ## Challenge 4
Use `show LEDs` to display images instead of text for each case. Use `show LEDs` to display images instead of text for each case.

View File

@ -2,11 +2,11 @@
Show a number on the LED screen. Show a number on the LED screen.
### ~avatar avatar ## ~avatar avatar
Let's learn how to show the lucky number 7 on the LED screen. Let's learn how to show the lucky number 7 on the LED screen.
### ~ ## ~
We will use `show number` to display a number on the screen. The argument (`7`) is the number to display. We will use `show number` to display a number on the screen. The argument (`7`) is the number to display.
@ -14,9 +14,9 @@ We will use `show number` to display a number on the screen. The argument (`7`)
basic.showNumber(7) basic.showNumber(7)
``` ```
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/lucky-7/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/lucky-7/challenges)!
### ~ ## ~

View File

@ -10,7 +10,7 @@ Complete the [lucky 7 activity](/lessons/lucky-7/activity) and your code will lo
basic.showNumber(7) basic.showNumber(7)
``` ```
### Challenge 1 ## Challenge 1
But we also should pause before showing another number. Let's add a pause of 500 milliseconds. But we also should pause before showing another number. Let's add a pause of 500 milliseconds.
@ -19,7 +19,7 @@ basic.showNumber(7)
basic.pause(500) basic.pause(500)
``` ```
### Challenge 2 ## Challenge 2
What about other multiples of 7? Let's display the next multiple of 7 on the screen! What about other multiples of 7? Let's display the next multiple of 7 on the screen!
@ -31,7 +31,7 @@ basic.showNumber(14)
* Run the code to see if it works as expected. * Run the code to see if it works as expected.
### Challenge 3 ## Challenge 3
Keep displaying multiples of 7 such as 21 and 28... Keep displaying multiples of 7 such as 21 and 28...

View File

@ -4,9 +4,9 @@ Coding challenges for lucky 7.
###~ Avatar ###~ Avatar
### @video td/videos/lucky-7-1-2 ## @video td/videos/lucky-7-1-2
### Rebuild the game! ## Rebuild the game!
The blocks have been shuffled! Put them back together so that… The blocks have been shuffled! Put them back together so that…
* The blocks should be multiples of 7 and a pause between the numbers * The blocks should be multiples of 7 and a pause between the numbers
@ -17,7 +17,7 @@ basic.pause(500)
basic.showNumber(14) basic.showNumber(14)
``` ```
### Hints and tips ## Hints and tips
Cut out these documentation cards to help you! Cut out these documentation cards to help you!

View File

@ -114,9 +114,9 @@ input.onGesture(Gesture.Shake, () => {
}) })
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/magic-8/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/magic-8/challenges)!
### ~ ## ~

View File

@ -26,7 +26,7 @@ input.onGesture(Gesture.Shake, () => {
``` ```
### Challenge 1 ## Challenge 1
Now let's increase the number of responses the magic 8 ball can give. How about 5 responses instead? Let's change the limit of `pick random` to 4. Now let's increase the number of responses the magic 8 ball can give. How about 5 responses instead? Let's change the limit of `pick random` to 4.
@ -49,7 +49,7 @@ input.onGesture(Gesture.Shake, () => {
}) })
``` ```
### Challenge 2 ## Challenge 2
Now have the magic 8 ball respond "Try again" if **randomNumber** is 3. Now have the magic 8 ball respond "Try again" if **randomNumber** is 3.
@ -73,7 +73,7 @@ input.onGesture(Gesture.Shake, () => {
}) })
``` ```
### Challenge 3 ## Challenge 3
Now what about if **randomNumber** is 4? Let's have the magic 8 ball respond "Definitely!". Now what about if **randomNumber** is 4? Let's have the magic 8 ball respond "Definitely!".

View File

@ -2,7 +2,7 @@
Show a string to instruct the user how to play Magic 8! The magic 8 ball can only answer questions with "YES", "NO", or "MAYBE"... Show a string to instruct the user how to play Magic 8! The magic 8 ball can only answer questions with "YES", "NO", or "MAYBE"...
### Rebuild the game! ## Rebuild the game!
The blocks have been shuffled! Put them back together so that... The blocks have been shuffled! Put them back together so that...
* show "ASK A QUESTION" on the screen * show "ASK A QUESTION" on the screen

View File

@ -2,11 +2,11 @@
Show an image that points up when the logo is up. Show an image that points up when the logo is up.
### ~avatar avatar ## ~avatar avatar
Welcome! This tutorial will help you display an arrow pointing toward the logo! Let's get started. Welcome! This tutorial will help you display an arrow pointing toward the logo! Let's get started.
### ~ ## ~
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. 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.
@ -32,9 +32,9 @@ input.onGesture(Gesture.LogoUp, () => {
Run your code and try to turn around the @boardname@ 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 ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/magic-logo/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/magic-logo/challenges)!
### ~ ## ~

View File

@ -20,7 +20,7 @@ input.onLogoUp(() => {
``` ```
### Challenge 1 ## Challenge 1
How about when the logo is down? We should display an arrow pointing downward! How about when the logo is down? We should display an arrow pointing downward!
@ -48,11 +48,11 @@ input.onLogoDown(() => {
``` ```
### Challenge 2 ## Challenge 2
Use the `on screen up` event to show a spinning arrow when the screen is turned up. Use the `on screen up` event to show a spinning arrow when the screen is turned up.
### Challenge 3 ## Challenge 3
Display another animation using the `on screen up` event. Display another animation using the `on screen up` event.

View File

@ -2,11 +2,11 @@
Change the brightness of the @boardname@. Change the brightness of the @boardname@.
### ~avatar avatar ## ~avatar avatar
Welcome! This tutorial will teach you how to change the brightness of the @boardname@. Let's get started! Welcome! This tutorial will teach you how to change the brightness of the @boardname@. Let's get started!
### ~ ## ~
The brightness of the LED screen can be changed by using the `set brightness` function. This function takes a number between ``0`` (off) and ``255`` (full brightness). The brightness of the LED screen can be changed by using the `set brightness` function. This function takes a number between ``0`` (off) and ``255`` (full brightness).
@ -57,9 +57,9 @@ input.onButtonPressed(Button.A, () => {
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/night-light/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/night-light/challenges)!
### ~ ## ~

View File

@ -21,7 +21,7 @@ input.onButtonPressed(Button.A, () => {
}) })
``` ```
### Challenge 1 ## Challenge 1
@ -46,6 +46,6 @@ input.onButtonPressed(Button.B, () => {
``` ```
### Challenge 3 ## Challenge 3
Add an event handler with `on shake` to change the LED brightness back to a `255`. Add an event handler with `on shake` to change the LED brightness back to a `255`.

View File

@ -42,7 +42,7 @@ basic.forever(() => {
``` ```
### Challenge 1 ## Challenge 1
What if wanted to show the maximum connectivity of wifi instead of just 1, 3, or 4 bars? What if wanted to show the maximum connectivity of wifi instead of just 1, 3, or 4 bars?
@ -86,7 +86,7 @@ basic.forever(() => {
}) })
``` ```
### Challenge 2 ## Challenge 2
Let's add an **IF** at the bottom of your code that checks to see if `sum >= to 1200` **and** if `sum <1400` Let's add an **IF** at the bottom of your code that checks to see if `sum >= to 1200` **and** if `sum <1400`
@ -135,7 +135,7 @@ basic.forever(() => {
}) })
``` ```
### Challenge 3 ## Challenge 3
Now it's your turn! Be creative and change the Wifi meter images to your own wifi image you're sure will prank your friends by editing the lines that call `showLeds()`. Now it's your turn! Be creative and change the Wifi meter images to your own wifi image you're sure will prank your friends by editing the lines that call `showLeds()`.

View File

@ -2,11 +2,11 @@
Rotate images with a while loop. Rotate images with a while loop.
### ~avatar avatar ## ~avatar avatar
Welcome! This tutorial will teach how to rotate images with a **while loop**. Let's get started! Welcome! This tutorial will teach how to rotate images with a **while loop**. Let's get started!
### ~ ## ~
Let's start by creating a global variable called `rotating` and initialize it to true. This well indicate when the animation should be displaying. Let's start by creating a global variable called `rotating` and initialize it to true. This well indicate when the animation should be displaying.
@ -61,9 +61,9 @@ while (rotating) {
} }
``` ```
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/rotation-animation/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/rotation-animation/challenges)!
### ~ ## ~

View File

@ -47,7 +47,7 @@ while (rotating) {
``` ```
### Challenge 1 ## Challenge 1
Now let's add to this by creating a condition for on button pressed `A` before the while loop. We will also introduce serial writeLine for the while loop and input OnButtonPressed Now let's add to this by creating a condition for on button pressed `A` before the while loop. We will also introduce serial writeLine for the while loop and input OnButtonPressed
@ -91,7 +91,7 @@ input.onButtonPressed(Button.A, () => {
``` ```
### Challenge 2 ## Challenge 2
@ -139,7 +139,7 @@ input.onButtonPressed(Button.A, () => {
* Run the code to see the awesome rotation. * Run the code to see the awesome rotation.
### Challenge 3 ## Challenge 3
Let's also make the image rotate the opposite way when button A is pressed! We can do this with another while loop that is only executed while `not rotating`. Let's also make the image rotate the opposite way when button A is pressed! We can do this with another while loop that is only executed while `not rotating`.

View File

@ -2,13 +2,13 @@
Clear the screen by pressing buttons on the @boardname@ Clear the screen by pressing buttons on the @boardname@
### ~avatar avatar ## ~avatar avatar
This activity will teach how to clear the screen by pressing button A on the @boardname@. This activity will teach how to clear the screen by pressing button A on the @boardname@.
### ~ ## ~
You can use the clear screen` function to turn off all the LED on the screen. Let's illustrate this concept with a small script where the user has to press the button A to turn off the screen. Let's start by adding the code to show an animation. You can use the clear screen` function to turn off all the LED on the screen. Let's illustrate this concept with a small script where the user has to press the button A to turn off the screen. Let's start by adding the code to show an animation.
@ -82,9 +82,9 @@ input.onButtonPressed(Button.A, () => {
*Run* the script in the simulator or on the @boardname@ to see how this works! *Run* the script in the simulator or on the @boardname@ to see how this works!
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/screen-wipe/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/screen-wipe/challenges)!
### ~ ## ~

View File

@ -41,7 +41,7 @@ input.onButtonPressed(Button.A, () => {
``` ```
### Challenge 1 ## Challenge 1
Create an event handler for Button B. Create an event handler for Button B.
@ -83,7 +83,7 @@ input.onButtonPressed(Button.B, () => {
``` ```
### Challenge 2 ## Challenge 2
@ -155,7 +155,7 @@ basic.showLeds(`
``` ```
### Challenge 3 ## Challenge 3
Show an animation that scrolls back up when you press button "B". Show an animation that scrolls back up when you press button "B".

View File

@ -2,11 +2,11 @@
Welcome! In this project, you will build your own seismograph. This activity will teach how to use the @boardname@ to chart the strength of the acceleration. Let's get started! Project duration: 25 minutes. Welcome! In this project, you will build your own seismograph. This activity will teach how to use the @boardname@ to chart the strength of the acceleration. Let's get started! Project duration: 25 minutes.
### ~avatar avatar ## ~avatar avatar
Engineering: In this project, you will build your own seismograph @boardname@ from tape and a household plate. Engineering: In this project, you will build your own seismograph @boardname@ from tape and a household plate.
### ~ ## ~
## What you'll need: ## What you'll need:
@ -32,11 +32,11 @@ Fasten Tape: Fasten tape to the micro USB cable and to the plate. Attach the @bo
![](/static/mb/lessons/seismograph0.png) ![](/static/mb/lessons/seismograph0.png)
### ~avatar avatar ## ~avatar avatar
Computer Science: The seismograph has been built. We are ready to program the @boardname@ to be a seismograph! Computer Science: The seismograph has been built. We are ready to program the @boardname@ to be a seismograph!
### ~ ## ~
# Programming Steps # Programming Steps
@ -70,13 +70,13 @@ basic.forever(() => {
``` ```
### ~ ## ~
### ~avatar avatar ## ~avatar avatar
Data Analysis: We now need to use the @boardname@ to Analyze Data and chart for the strength of the acceleration. Data Analysis: We now need to use the @boardname@ to Analyze Data and chart for the strength of the acceleration.
### ~ ## ~
# Data Analysis Steps # Data Analysis Steps
@ -178,9 +178,9 @@ Let's select Style 10 as an example.
![](/static/mb/lessons/analyze19.png) ![](/static/mb/lessons/analyze19.png)
### ~avatar avatar ## ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/seismograph/challenge) Excellent, you're ready to continue with the [challenges](/lessons/seismograph/challenge)
### ~ ## ~

View File

@ -3,11 +3,11 @@
Coding challenges for the seismograph. Coding challenges for the seismograph.
### ~avatar avatar ## ~avatar avatar
Engineering: In this project, you will build a remote control based on the seismograph @boardname@ activity using a second @boardname@ and micro USB cable. Engineering: In this project, you will build a remote control based on the seismograph @boardname@ activity using a second @boardname@ and micro USB cable.
### ~ ## ~
## What you'll need: ## What you'll need:
@ -30,9 +30,9 @@ basic.forever(() => {
``` ```
### ~avatar avatar ## ~avatar avatar
Computer Science: Welcome! The activity will teach you how to code the acceleration of the 1st @boardname@ and to visualize the acceleration on the 2nd @boardname@. Let's get started! Computer Science: Welcome! The activity will teach you how to code the acceleration of the 1st @boardname@ and to visualize the acceleration on the 2nd @boardname@. Let's get started!
### ~ ## ~
# Computer Science Steps # Computer Science Steps
@ -97,9 +97,9 @@ radio.onDataPacketReceived(({ receivedNumber }) => {
}); });
``` ```
### ~avatar avatar ## ~avatar avatar
Science: Welcome! The activity will teach you how to chart the acceleration of the 1st @boardname@ and to visualize the acceleration on the 2nd @boardname@. Let's get started! Science: Welcome! The activity will teach you how to chart the acceleration of the 1st @boardname@ and to visualize the acceleration on the 2nd @boardname@. Let's get started!
### ~ ## ~
# Science Steps # Science Steps
@ -190,7 +190,7 @@ Let's select Style 10 as an example.
![](/static/mb/lessons/analyze19.png) ![](/static/mb/lessons/analyze19.png)
### ~ ## ~
* Have fun reviewing your seismograph data and analyzing the acceleration with Excel. * Have fun reviewing your seismograph data and analyzing the acceleration with Excel.
* The first person and second person take shaking or moving the micor:bit in any direction while the other player charts the data on the @boardname@! * The first person and second person take shaking or moving the micor:bit in any direction while the other player charts the data on the @boardname@!
* Review and analyze the actual @boardname@ device acceleration data on Excel * Review and analyze the actual @boardname@ device acceleration data on Excel

View File

@ -19,8 +19,8 @@ Learn how to **show LEDs** to turn on a LED light pattern on the LED screen. We
## Documentation ## Documentation
* **show LEDs** : [read more...](/reference/basic/show-leds) * **[show LEDs](/reference/basic/show-leds)**
* **on button pressed** : [read more...](/reference/input/on-button-pressed) * **[on button pressed](/reference/input/on-button-pressed)**
```cards ```cards
input.onButtonPressed(Button.A, () => {}) input.onButtonPressed(Button.A, () => {})

View File

@ -2,13 +2,13 @@
Learn to design a blinking image. Learn to design a blinking image.
### ~avatar avatar ## ~avatar avatar
Welcome! This tutorial will help you make a smiley face blink. Let's get started! Welcome! This tutorial will help you make a smiley face blink. Let's get started!
### ~ ## ~
Create an animation with an image displaying a smiley face and the next image with no LEDs lit up. This will make it look like the smiley face is blinking as the display switches between images. Create an animation with an image displaying a smiley face and the next image with no LEDs lit up. This will make it look like the smiley face is blinking as the display switches between images.
@ -29,9 +29,9 @@ basic.showLeds(`
`) `)
``` ```
### ~avatar boothing ## ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/smiley/challenges)! Excellent, you're ready to continue with the [challenges](/lessons/smiley/challenges)!
### ~ ## ~

View File

@ -25,7 +25,7 @@ basic.showLeds(`
``` ```
### Challenge 1 ## Challenge 1
What if we want to make the face to frown on button pressed A? What if we want to make the face to frown on button pressed A?
@ -52,7 +52,7 @@ input.onButtonPressed(Button.A, () => {
}) })
``` ```
### Challenge 2 ## Challenge 2
@ -87,7 +87,7 @@ input.onButtonPressed(Button.A, () => {
* Run your code to see if it works as expected. * Run your code to see if it works as expected.
### Challenge 3 ## Challenge 3
When *button B* is pressed, let's change the sad face back to a happy face. To do this, begin by adding a condition for `on button pressed` *B*. Next, show LEDs as a smiley face inside the condition. When *button B* is pressed, let's change the sad face back to a happy face. To do this, begin by adding a condition for `on button pressed` *B*. Next, show LEDs as a smiley face inside the condition.

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