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
+1 -1
View File
@@ -28,7 +28,7 @@ basic.showAnimation(`
`);
```
### See also
## See also
[showNumber](/reference/basic/show-number),
[showIcon](/reference/basic/show-icon),
+2 -2
View File
@@ -6,7 +6,7 @@ Turn off all the LED lights on the [LED screen](/device/screen).
basic.clearScreen()
```
### Example: Vanishing heart
## Example: Vanishing heart
The following code shows a heart on the screen and then turns off all the LED lights.
@@ -21,7 +21,7 @@ basic.showLeds(`
basic.clearScreen()
```
### See also
## See also
[set brightness](/reference/led/set-brightness), [unplot](/reference/led/unplot), [plot](/reference/led/plot), [Image](/reference/images/image)
+4 -4
View File
@@ -8,7 +8,7 @@ basic.forever(() => {
})
```
### Example: compass
## Example: compass
The following example constantly checks the
[compass heading](/reference/input/compass-heading)
@@ -31,7 +31,7 @@ basic.forever(() => {
})
```
### Example: counter
## Example: counter
The following example keeps showing the [number](/types/number) stored in a global variable.
When you press button `A`, the number gets bigger.
@@ -47,7 +47,7 @@ input.onButtonPressed(Button.A, () => {
})
```
### Competing for the LED screen
## Competing for the LED screen
If different parts of a program are each trying
to show something on the LED screen at the same time,
@@ -63,7 +63,7 @@ input.onButtonPressed(Button.A, () => {
})
```
### See also
## See also
[while](/blocks/loops/while), [on button pressed](/reference/input/on-button-pressed), [in background](/reference/control/in-background)
+3 -3
View File
@@ -7,11 +7,11 @@ You can use this function to slow your program down.
basic.pause(400)
```
### Parameters
## Parameters
* ``ms`` is the number of milliseconds that you want to pause (100 milliseconds = 1/10 second, and 1000 milliseconds = 1 second).
### Example: diagonal line
## Example: diagonal line
This example draws a diagonal line by turning on LED `0, 0` (top left) through LED `4, 4` (bottom right).
The program pauses 500 milliseconds after turning on each LED.
@@ -24,7 +24,7 @@ for (let i = 0; i < 5; i++) {
}
```
### See also
## See also
[while](/blocks/loops/while), [running time](/reference/input/running-time), [for](/blocks/loops/for)
+3 -3
View File
@@ -12,11 +12,11 @@ basic.showLeds(`
`)
```
### Parameters
## Parameters
* leds - a series of LED on/off states that form an image (see steps below)
### Example: smiley
## Example: smiley
```blocks
basic.showLeds(`
@@ -28,7 +28,7 @@ basic.showLeds(`
`)
```
### See also
## See also
[show animation](/reference/basic/show-animation), [image](/reference/images/image), [show image](/reference/images/show-image), [scroll image](/reference/images/scroll-image)
+7 -7
View File
@@ -12,12 +12,12 @@ basic.showAnimation(`
`)
```
### Parameters
## Parameters
* `leds` is a [string](/types/string) that shows which LEDs are on and off, in groups one after another.
* `interval` is an optional [number](/types/number). It means the number of milliseconds to pause after each image frame.
### Example: Animating a group of image frames
## Example: Animating a group of image frames
In this animation, each row is 15 spaces wide because
there are three frames in the animation, and each frame is
@@ -33,13 +33,13 @@ basic.showAnimation(`
`)
```
### ~hint
## ~hint
If the animation is too fast, make `interval` bigger.
### ~
## ~
### Example: animating frames with a pause
## Example: animating frames with a pause
This example shows six frames on the screen, pausing 500 milliseconds after each frame.
@@ -57,8 +57,8 @@ basic.showAnimation(`
`, 500)
```
### ~hint
## ~hint
Use [forever](/reference/basic/forever) to show an animation over and over.
### ~
## ~
+3 -3
View File
@@ -7,12 +7,12 @@ basic.showArrow(ArrowNames.North)
```
### Parameters
## Parameters
* ``direction``, the identifier of the arrow to display
* ``interval`` (optional), the time to display in milliseconds. default is 400.
### Example
## Example
This program shows all eight arrows.
@@ -23,7 +23,7 @@ for (let index = 0; index <= 7; index++) {
}
```
### See also
## See also
[showIcon](/reference/basic/show-icon),
[showLeds](/reference/basic/show-leds)
+3 -3
View File
@@ -6,12 +6,12 @@ Shows the selected icon on the LED screen
basic.showIcon(IconNames.Heart)
```
### Parameters
## Parameters
* ``icon``, the identifier of the icon to display
* ``interval`` (optional), the time to display in milliseconds. default is 400.
### Example
## Example
This program shows a happy face and then a sad face with the ``show icon`` function, with a one second pause in between.
@@ -21,6 +21,6 @@ basic.pause(1000)
basic.showIcon(IconNames.Sad)
```
### See also
## See also
[showLeds](/reference/basic/show-leds)
+5 -5
View File
@@ -13,13 +13,13 @@ basic.showLeds(`
)
```
### Parameters
## Parameters
* `leds` is a [string](/types/string) that controls which LEDs are on and off.
* `interval` is an optional [number](/types/number) that means how many milliseconds to wait after showing a picture.
If you are programming with blocks, `interval` is set at 400 milliseconds.
### Example
## Example
This program shows a picture with the ``show leds`` function.
@@ -34,14 +34,14 @@ basic.showLeds(`
)
```
### ~hint
## ~hint
If you are programming in JavaScript, `#` means an LED that is turned
on and `.` means an LED that is turned off.
### ~
## ~
### See also
## See also
[plot leds](/reference/basic/plot-leds), [show animation](/reference/basic/show-animation)
+5 -5
View File
@@ -6,12 +6,12 @@ Show a number on the [LED screen](/device/screen). It will slide left if it has
basic.showNumber(2)
```
### Parameters
## Parameters
* `value` is a [Number](/types/number).
* `interval` is an optional [Number](/types/number). It means the number of milliseconds before sliding the `value` left by one LED each time. Bigger intervals make the sliding slower.
### Examples:
## Examples:
To show the number 10:
@@ -26,7 +26,7 @@ let x = 1
basic.showNumber(x)
```
### Example: count to 5
## Example: count to 5
This example uses a [for](/blocks/loops/for) loop to show numbers ``0`` through ``5`` on the screen:
@@ -37,12 +37,12 @@ for (let i = 0; i < 6; i++) {
}
```
### Other show functions
## Other show functions
* Use [show string](/reference/basic/show-string) to show a [String](/types/string) with letters on the screen.
* Use [show animation](/reference/basic/show-animation) to show a group of pictures on the screen, one after another.
### See also
## See also
[show string](/reference/basic/show-string), [show animation](/reference/basic/show-animation), [Number](/types/number), [math](/blocks/math)
+4 -4
View File
@@ -6,12 +6,12 @@ Show a number on the [LED screen](/device/screen). It will slide left if it is b
basic.showString("Hello!")
```
### Parameters
## Parameters
* `text` is a [String](/types/string). It can contain letters, numbers, and punctuation.
* `interval` is an optional [Number](/types/number). It means the number of milliseconds before sliding the [String](/types/string) left by one LED each time. Bigger intervals make the sliding slower.
### Examples:
## Examples:
To show the word **Hello**:
@@ -26,12 +26,12 @@ let s = "Hi"
basic.showString(s)
```
### Other show functions
## Other show functions
* Use [show number](/reference/basic/show-number) to show a number on the [LED screen](/device/screen).
* Use [show animation](/reference/basic/show-animation) to show a group of pictures on the screen, one after another.
### See also
## See also
[String](/types/string), [show number](/reference/basic/show-number), [show animation](/reference/basic/show-animation)
+4 -4
View File
@@ -2,12 +2,12 @@
Support for additional Bluetooth services.
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
```cards
@@ -41,11 +41,11 @@ bluetooth.advertiseUrl("https://makecode.microbit.org/", 7, true);
bluetooth.stopAdvertising();
```
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth UART service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/uart-service/)
### See Also
## See Also
[startAccelerometerService](/reference/bluetooth/start-accelerometer-service), [startButtonService](/reference/bluetooth/start-button-service), [startIOPinService](/reference/bluetooth/start-io-pin-service), [startLEDService](/reference/bluetooth/start-led-service), [startMagnetometerService](/reference/bluetooth/start-magnetometer-service), [startTemperatureService](/reference/bluetooth/start-temperature-service),
[startUartService](/reference/bluetooth/start-uart-service),
+8 -8
View File
@@ -18,21 +18,21 @@ A Bluetooth device contains a table of data called an Attribute Table which can
The Attribute Table contains something like a series of records of various types. The main types are called Services, Characteristics and Descriptors. Let's look at each of these terms in turn.
### Attributes
## Attributes
Services, Characteristics and Descriptors are all types of Attribute. Hence Generic Attribute Profile, Attribute Table and something called the Attribute Protocol. All attributes have a type which is identified by a UUID (Universally Unique Identifer). Some Attributes are defined by the Bluetooth SIG, the technical standards body for Bluetooth and these have UUIDs which are 16 bits in length. Some Attributes are custom designed for a particular device by the product team and these have 128 bit UUIDs. The @boardname@ uses a mixture of 16 bit and 128 bit UUIDs.
### Structure
## Structure
Services, Characteristics and Descriptors are organised in a hierarchy with Services at the top and Descriptors at the bottom. Services contain one or more Characteristics. A Characteristic owns zero or more Descriptors. Zero because Descriptors are completely optional whereas a Service must contain at least one Characteristic.
![](/static/bluetooth/gatt_hierarchy.png)
### Services
## Services
A Service is a container for logically related Bluetooth data items. Those data items are in fact called Characteristics. A Service can be thought of as the owner of the Characteristics inside it. Often a Service represents a particular feature (e.g. a hardware feature) of a device like the buttons or a particular sensor. An example of a Bluetooth SIG defined Service is the Device Information Service which, as the name suggests, is a container for various items of information about the device such as its manufacturer and serial number. The @boardname@ has this service.
### Characteristics
## Characteristics
Characteristics are items of data which relate to a particular internal state of the device or perhaps some state of the environment which the device can measure using a sensor. The current battery level is an example of internal state data whereas the ambient temperature could perhaps be measured by a sensor. Sometimes Characteristics represent configuration data such as the frequency at which you want something to be measured. In any of these cases, the way a device can expose such data to other devices to use via Bluetooth is by making them available as a Characteristic. An example of a Bluetooth SIG defined Characteristic is the Serial Number String which you'll find inside the Device Information service.
@@ -46,11 +46,11 @@ Sometimes the device will have been programmed to respond in a special way when
Permissions are to do with security and further describe the security conditions that must be met before read or write access to the characteristic is to be granted.
### Descriptors
## Descriptors
Descriptors contain meta data which either augments the details relating to the Characteristic which the Descriptor belongs to or allows the configuration of a behaviour involving that Characteristic. Notification messages are switched on or off using a special descriptor called the Client Characteristic Configuration Descriptor for example.
### Profile
## Profile
A Bluetooth profile is a specification which pulls together all the required information about how a device behaves, how it can be accessed in terms of its services, characteristics and descriptors, security rules, concurrency limitations and so on.
@@ -86,11 +86,11 @@ That's it! Enjoy using Bluetooth on the @boardname@!
Martin Woolley, Bluetooth SIG. Twitter: @bluetooth_mdw
#### Video
### Video
https://www.youtube.com/watch?v=aep_GVowKfs
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -4,7 +4,7 @@ Advertises a UID via the Eddystone protocol over Bluetooth.
## ~hint
### Eddystone
## Eddystone
Bluetooth beacons are used to indicate proximity to a place or object of interest.
Beacons use Bluetooth advertising to broadcast a small amount of data,
@@ -21,7 +21,7 @@ Read more at https://lancaster-university.github.io/microbit-docs/ble/eddystone/
bluetooth.advertiseUidBuffer(pins.createBuffer(16), 7, true);
```
### Parameters
## Parameters
* ``buffer`` - a 16 bytes buffer containing the namespace (first 10 bytes) and instance (last 6 bytes).
* ``power`` - a [number](/types/number) representing the power level between 0 (short) and 7 (maximum range).
+2 -2
View File
@@ -4,7 +4,7 @@ Advertises a UID via the Eddystone protocol over Bluetooth.
## ~hint
### Eddystone
## Eddystone
Bluetooth beacons are used to indicate proximity to a place or object of interest.
Beacons use Bluetooth advertising to broadcast a small amount of data,
@@ -21,7 +21,7 @@ Read more at https://lancaster-university.github.io/microbit-docs/ble/eddystone/
bluetooth.advertiseUid(42, 1, 7, true);
```
### Parameters
## Parameters
* ``namespace`` last 4 bytes of the namespace uid (6 to 9)
* ``instance`` last 4 bytes of the instance (2 to 5)
+3 -3
View File
@@ -4,7 +4,7 @@ Advertises a URL via the Eddystone protocol over Bluetooth.
## ~hint
### Eddystone
## Eddystone
Bluetooth beacons are used to indicate proximity to a place or object of interest.
Beacons use Bluetooth advertising to broadcast a small amount of data,
@@ -21,13 +21,13 @@ Read more at https://lancaster-university.github.io/microbit-docs/ble/eddystone/
bluetooth.advertiseUrl("https://makecode.microbit.org/", 7, true);
```
### Parameters
## Parameters
* ``url`` - a [string](/types/string) containing the URL to broadcast, at most 17 characters long, excluding the protocol (eg: ``https://``) which gets encoded as 1 byte.
* ``power`` - a [number](/types/number) representing the power level between 0 (short) and 7 (maximum range).
* ``connectable`` - a [boolean](/blocks/logic/boolean) indicating whether or not the @boardname@ should accept connections.
### Example: Broadcast a secret code
## Example: Broadcast a secret code
```blocks
bluetooth.advertiseUrl("https://pxt.io?secret=42", 7, true);
+11 -11
View File
@@ -1,13 +1,13 @@
# Bluetooth Pairing
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
### What is 'pairing'?
## What is 'pairing'?
'Pairing' is what you have to do to have your @boardname@ trust another device like a smartphone and similarly, have your smartphone trust your @boardname@. Why 'trust'? Well, pairing is all about security. You wouldn't usually want just anyone's smartphone connecting to your @boardname@ and making it do things so by pairing *your* smartphone with *your* @boardname@ you ensure that only your devices can talk to each other.
@@ -26,7 +26,7 @@ To get your @boardname@ ready for pairing do the following:
Your @boardname@ is now ready to be paired with the other device. Read the section below which relates to your 'other' device and watch the video too.
### How do you pair your @boardname@ with a Windows smartphone or tablet?
## How do you pair your @boardname@ with a Windows smartphone or tablet?
1. Go into Settings
2. Select Bluetooth
@@ -38,11 +38,11 @@ Your @boardname@ is now ready to be paired with the other device. Read the secti
8. Enter the 6 digits which the @boardname@ displayed into your Windows smartphone in the pop-up box provided and then select "done".
9. If you entered the right number the @boardname@ will display a tick / check mark. If you made a mistake it will display a cross or X and you should repeat the process to try again.
#### Video
### Video
https://www.youtube.com/watch?v=AoW3mit7jIg
### How do you pair your @boardname@ with an Android smartphone or tablet?
## How do you pair your @boardname@ with an Android smartphone or tablet?
1. Go into Settings
2. Select Bluetooth
@@ -54,10 +54,10 @@ https://www.youtube.com/watch?v=AoW3mit7jIg
8. Enter the 6 digits which the @boardname@ displayed into your Android smartphone in the pop-up box provided and then select "done".
9. If you entered the right number the @boardname@ will display a tick / check mark. If you made a mistake it will display a cross or X and you should repeat the process to try again.
#### Video
### Video
https://www.youtube.com/watch?v=7hLBfdAGkZI
### How do you pair your @boardname@ with an Apple iOS smartphone or tablet?
## How do you pair your @boardname@ with an Apple iOS smartphone or tablet?
The steps to pair with an Apple iOS device are different to those followed for an Android or Windows device. To trigger pairing you need an application which will try to interact with your @boardname@ and it's that interaction that triggers the iOS pairing process. There are many you could use but for the purposes of this documentation we'll suggest you install the "nRF Master Control Panel" (nRF MCP) application from Nordic Semiconductor. You'll find it in the Apple app store. It's a really useful Bluetooth application which will help you learn about Bluetooth as well as it having the ability to trigger the pairing process. After installing nRF MCP you should follow these steps to pair with your @boardname@:
@@ -70,11 +70,11 @@ The steps to pair with an Apple iOS device are different to those followed for a
7. Enter the 6 digits which the @boardname@ displayed into your Apple device in the pop-up box provided and then select "Pair".
8. If you entered the right number the @boardname@ will display a tick / check mark. If you made a mistake it will display a cross or X and you should repeat the process to try again.
#### Video
### Video
https://www.youtube.com/watch?v=wslwyAMwMhs
### How often do I need to pair my @boardname@ with my phone?
## How often do I need to pair my @boardname@ with my phone?
You do *not* need to pair your @boardname@ and smartphone or tablet every time you use them together. Pairing establishes 'trust' which will be retained until it is somehow lost. When another device wants to talk to your @boardname@ it must connect to it but connecting and pairing are not the same thing.
@@ -90,7 +90,7 @@ If you do find yourself needing to pair again you will first need to remove the
* On iOS go into Settings/Bluetooth, select your @boardname@ and then select Forget This Device
* On a Windows device go into Settings/Bluetooth. Press and hold the @boardname@ entry on the Windows device. A pop-up will appear with the option "delete". Select "delete" to unpair your @boardname@.
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# On Bluetooth Connected
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
This block starts an [event handler](/reference/event-handler) which in this case will run
when something connects to your @boardname@ using Bluetooth.
@@ -14,7 +14,7 @@ when something connects to your @boardname@ using Bluetooth.
bluetooth.onBluetoothConnected(() => {});
```
### Example
## Example
You could use this event handler to display a letter "C" on the @boardname@ LED grid so you know you have a Bluetooth connection. Or you might want to send some data you've been accumulating to your smartphone as soon as it connects to your @boardname@. Maybe you've been using the accelerometer in your @boardname@ to count your steps for example. Using this event handler you could send the accumulated step count to your phone when it establishes a Bluetooth connection.
@@ -24,11 +24,11 @@ bluetooth.onBluetoothConnected(() => {
});
```
### Video - on Bluetooth connected
## Video - on Bluetooth connected
http://www.youtube.com/watch?v=HyBcsD9Eh6I
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# On Bluetooth Disconnected
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
This block starts an [event handler](/reference/event-handler) which in this case will run when a device which is connected to your @boardname@ over Bluetooth disconnects.
@@ -16,7 +16,7 @@ bluetooth.onBluetoothDisconnected(() => {
});
```
### Example: Displaying "D" when a Bluetooth connection to the @boardname@ is closed
## Example: Displaying "D" when a Bluetooth connection to the @boardname@ is closed
```blocks
bluetooth.onBluetoothDisconnected(() => {
@@ -24,11 +24,11 @@ bluetooth.onBluetoothDisconnected(() => {
});
```
### Video - on Bluetooth disconnected
## Video - on Bluetooth disconnected
http://www.youtube.com/watch?v=HyBcsD9Eh6I
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -6,11 +6,11 @@ Registers an event to be fired when one of the delimiter is matched.
bluetooth.onUartDataReceived(",", () => {})
```
### Parameters
## Parameters
* `delimiters` is a [string](/types/string) containing any of the character to match
### Example
## Example
Read values separated by `,`:
@@ -1,11 +1,11 @@
# Bluetooth Set Transmit Power
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
Change the output power level of the transmitter to the given value.
@@ -13,11 +13,11 @@ Change the output power level of the transmitter to the given value.
bluetooth.setTransmitPower(7);
```
### Parameters
## Parameters
* `power`: a [number](/types/number) in the range ``0..7``, where ``0`` is the lowest power and ``7`` is the highest.
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# Bluetooth Accelerometer Service
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The Bluetooth accelerometer service allows another device such as a smartphone to wirelessly receive data from the @boardname@'s accelerometer. An accelerometer detects motion. More precisely, it measures acceleration in one or more of three directions which we call X, Y and Z.
@@ -17,7 +17,7 @@ No additional code is needed on the @boardname@ to use the Bluetooth acceleromet
bluetooth.startAccelerometerService();
```
### Example: Starting the Bluetooth accelerometer service
## Example: Starting the Bluetooth accelerometer service
The following code shows the Bluetooth accelerometer service being started:
@@ -25,15 +25,15 @@ The following code shows the Bluetooth accelerometer service being started:
bluetooth.startAccelerometerService();
```
### Video - Accelerometer service demo - Starts at 0:18
## Video - Accelerometer service demo - Starts at 0:18
http://www.youtube.com/watch?v=aep_GVowKfs#t=18s
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth accelerometer service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/accelerometer-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# Bluetooth Button Service
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The Bluetooth button service makes it possible for another device such as a smartphone to be notified wirelessly whenever a button on the front of a @boardname@ is pressed. Each of the two @boardname@ buttons can be in one of three possible states:
@@ -21,7 +21,7 @@ No additional code is needed on the @boardname@ to use the Bluetooth button serv
bluetooth.startButtonService();
```
### Example: Starting the Bluetooth button service
## Example: Starting the Bluetooth button service
The following code shows the Bluetooth button service being started:
@@ -29,15 +29,15 @@ The following code shows the Bluetooth button service being started:
bluetooth.startButtonService();
```
### Video - Button service demo - Starts at 0:59
## Video - Button service demo - Starts at 0:59
http://www.youtube.com/watch?v=aep_GVowKfs
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth button service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/button-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# Bluetooth IO Pin Service
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The Bluetooth IO pin service makes it possible for another device such as a smartphone to communicate with other electronic 'things' connected to a @boardname@'s edge connector. You could for example, use your smartphone to switch on or off a light which is connected to the @boardname@ or your smartphone could receive data collected from a sensor connected to the @boardname@. In fact you could do both of these things at the same time since the Bluetooth IO pin service lets you interact with multiple 'pins' on the edge conector in different ways all at the same time.
@@ -15,7 +15,7 @@ No additional code is needed on the @boardname@ to use the Bluetooth IO pin serv
bluetooth.startIOPinService();
```
### Example: Starting the Bluetooth IO pin service
## Example: Starting the Bluetooth IO pin service
The following code shows the Bluetooth IO pin service being started:
@@ -23,15 +23,15 @@ The following code shows the Bluetooth IO pin service being started:
bluetooth.startIOPinService();
```
### Video - IO pin service demo starts at 3:49
## Video - IO pin service demo starts at 3:49
http://www.youtube.com/watch?v=aep_GVowKfs
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth IO pin service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/iopin-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# Bluetooth LED Service
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The Bluetooth LED service allows another device such as a smartphone to send short text strings or patterns over a Bluetooth connection to a @boardname@ for display on its LED matrix. Text will scroll across the @boardname@ and the speed at which it scrolls can also be controlled using the Bluetooth LED service. Devices using the LED service may also read the current state of the @boardname@'s LED matrix.
@@ -17,7 +17,7 @@ No additional code is needed on the @boardname@ to use the Bluetooth LED service
bluetooth.startLEDService();
```
### Example: Starting the Bluetooth LED service
## Example: Starting the Bluetooth LED service
The following code shows the Bluetooth LED service being started:
@@ -25,15 +25,15 @@ The following code shows the Bluetooth LED service being started:
bluetooth.startLEDService();
```
### Video - LED service demo starts at 2:00
## Video - LED service demo starts at 2:00
http://www.youtube.com/watch?v=aep_GVowKfs
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth LED service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/led-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# Bluetooth Magnetometer Service
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The Bluetooth magnetometer service allows another device such as a smartphone to wirelessly receive data from the @boardname@'s magnetometer. The magnetometer measures the strength and direction of magnetic fields including the earth's and so it can be used as a digital compass and indicate the way the @boardname@ is pointing relative to magnetic north.
@@ -17,7 +17,7 @@ No additional code is needed on the @boardname@ to use the Bluetooth magnetomete
bluetooth.startMagnetometerService();
```
### Example: Starting the Bluetooth magnetometer service
## Example: Starting the Bluetooth magnetometer service
The following code shows the Bluetooth magnetometer service being started:
@@ -25,15 +25,15 @@ The following code shows the Bluetooth magnetometer service being started:
bluetooth.startMagnetometerService();
```
### Video - Magnetometer service demo
## Video - Magnetometer service demo
http://www.youtube.com/watch?v=C_0VL4Gp4_U
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth magnetometer service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/magnetometer-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# Bluetooth Temperature Service
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
A @boardname@ is able to provide a rough measure of the current environmental temperature. It's an approximation only as in fact the temperature value is inferred from the temperature of its main processor. The Bluetooth temperature service allows another device such as a smartphone to wirelessly find out the @boardname@'s current temperature reading or to receive a constant stream of temperature data values. Temperature values are expressed in degrees celsius.
@@ -17,7 +17,7 @@ No additional code is needed on the @boardname@ to use the Bluetooth temperature
bluetooth.startTemperatureService();
```
### Example: Starting the Bluetooth temperature service
## Example: Starting the Bluetooth temperature service
The following code shows the Bluetooth temperature service being started:
@@ -25,15 +25,15 @@ The following code shows the Bluetooth temperature service being started:
bluetooth.startTemperatureService();
```
### Video - Temperature service demo - Starts at 3:05
## Video - Temperature service demo - Starts at 3:05
http://www.youtube.com/watch?v=aep_GVowKfs
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth temperature service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/temperature-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# Bluetooth UART Service
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The Bluetooth UART service allows another device such as a smartphone to exchange any data it wants to with the @boardname@, in small chunks which are intended to be joined together. [UART[(https://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter) stands for Universal Asynchronous Receiver Transmitter and is one way in which serial data communications can be performed, usually between two devices connected by a physical, wired connection. The Bluetooth UART service emulates the behaviour of a physical UART system and allows the exchange of a maximum of 20 bytes of data at a time in either direction.
@@ -19,7 +19,7 @@ To use the Bluetooth UART service from another device you'll need additional @bo
bluetooth.startUartService();
```
### Example: Starting the Bluetooth UART service
## Example: Starting the Bluetooth UART service
The following code shows the Bluetooth UART service being started:
@@ -27,15 +27,15 @@ The following code shows the Bluetooth UART service being started:
bluetooth.startUartService();
```
### Video - UART service guessing game
## Video - UART service guessing game
https://www.youtube.com/watch?v=PgGeWddMAZ0
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth UART service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/uart-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
+2 -2
View File
@@ -4,7 +4,7 @@ Stops advertising URL via the Eddystone protocol over Bluetooth.
## ~hint
### Eddystone
## Eddystone
Bluetooth beacons are used to indicate proximity to a place or object of interest.
Beacons use Bluetooth advertising to broadcast a small amount of data,
@@ -21,7 +21,7 @@ Read more at https://lancaster-university.github.io/microbit-docs/ble/eddystone/
bluetooth.stopAdvertising();
```
### Example: stop advertising on button pressed
## Example: stop advertising on button pressed
```blocks
input.onButtonPressed(Button.A, () => {
+6 -6
View File
@@ -1,11 +1,11 @@
# UART Read
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The [Bluetooth UART service](/reference/bluetooth/start-uart-service) allows another device such as a smartphone to exchange any data it wants to with the @boardname@, in small chunks.
@@ -15,7 +15,7 @@ With the Bluetooth UART service running, this block allows a @boardname@ to read
bluetooth.uartReadUntil("");
```
### Example: Starting the Bluetooth UART service and then reading data received from another device which is terminated by ":" character and then displaying it
## Example: Starting the Bluetooth UART service and then reading data received from another device which is terminated by ":" character and then displaying it
```blocks
let uartData = "";
@@ -35,15 +35,15 @@ bluetooth.onBluetoothDisconnected(() => {
```
### Video - UART service guessing game
## Video - UART service guessing game
https://www.youtube.com/watch?v=PgGeWddMAZ0
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth UART service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/uart-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# UART Write Number
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The [Bluetooth UART service](/reference/bluetooth/start-uart-service) allows another device such as a smartphone to exchange any data it wants to with the @boardname@, in small chunks.
@@ -15,11 +15,11 @@ With the Bluetooth UART service running, this block allows a @boardname@ to send
bluetooth.uartWriteNumber(42);
```
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth UART service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/uart-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
@@ -1,11 +1,11 @@
# UART Write String
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The [Bluetooth UART service](/reference/bluetooth/start-uart-service) allows another device such as a smartphone to exchange any data it wants to with the @boardname@, in small chunks.
@@ -15,7 +15,7 @@ With the Bluetooth UART service running, this block allows a @boardname@ to send
bluetooth.uartWriteString("");
```
### Example: Starting the Bluetooth UART service and then sending "HELLO" whenever button A is pressed and another device has connected over Bluetooth
## Example: Starting the Bluetooth UART service and then sending "HELLO" whenever button A is pressed and another device has connected over Bluetooth
```blocks
let connected = 0;
@@ -34,15 +34,15 @@ input.onButtonPressed(Button.A, () => {
});
```
### Video - UART service guessing game
## Video - UART service guessing game
https://www.youtube.com/watch?v=PgGeWddMAZ0
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth UART service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/uart-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
+4 -4
View File
@@ -1,11 +1,11 @@
# UART Write Value
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
The [Bluetooth UART service](/reference/bluetooth/start-uart-service) allows another device such as a smartphone to exchange any data it wants to with the @boardname@, in small chunks.
@@ -15,11 +15,11 @@ With the Bluetooth UART service running, this block allows a @boardname@ to send
bluetooth.uartWriteValue("x", 42);
```
### Advanced
## Advanced
For more advanced information on the @boardname@ Bluetooth UART service including information on using a smartphone, see the [Lancaster University @boardname@ runtime technical documentation](http://lancaster-university.github.io/microbit-docs/ble/uart-service/)
### See also
## See also
[About Bluetooth](/reference/bluetooth/about-bluetooth), [@boardname@ Bluetooth profile overview ](http://lancaster-university.github.io/microbit-docs/ble/profile/), [@boardname@ Bluetooth profile reference](http://lancaster-university.github.io/microbit-docs/resources/bluetooth/microbit-profile-V1.9-Level-2.pdf), [Bluetooth on @boardname@ resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html), [Bluetooth SIG](https://www.bluetooth.com)
+1 -1
View File
@@ -14,6 +14,6 @@ control.eventTimestamp();
control.eventValue();
```
### See Also
## See Also
[inBackground](/reference/control/in-background), [reset](/reference/control/reset), [waitMicros](/reference/control/wait-micros), [onEvent](/reference/control/on-event), [raiseEvent](/reference/control/raise-event), [eventTimestamp](/reference/control/event-timestamp), [eventValue](/reference/control/event-value)
+4 -4
View File
@@ -7,15 +7,15 @@ control.inBackground(() => {
})
```
### ~hint
## ~hint
For more information, read
[The @boardname@ - a reactive system](/device/reactive).
It is pretty advanced!
### ~
## ~
### Example
## Example
This program shows how running in the background can say what is
stored in a variable like `num`, while another part (``on button pressed``)
@@ -47,7 +47,7 @@ input.onButtonPressed(Button.A, () => {
})
```
### See also
## See also
[while](/blocks/loops/while), [forever](/reference/basic/forever),
[on button pressed](/reference/input/on-button-pressed)
+4 -4
View File
@@ -8,7 +8,7 @@ This function is like pressing the reset button on the back of the @boardname@.
control.reset()
```
### Example
## Example
This program will count as high as you like when you press button `A`.
When you get tired of counting, press button `B` to reset the
@@ -26,12 +26,12 @@ input.onButtonPressed(Button.B, () => {
});
```
#### ~hint
### ~hint
This program works better on a real @boardname@ than in the simulator.
#### ~
### ~
### See Also
## See Also
[clear screen](/reference/basic/clear-screen), [game over](/reference/game/game-over)
+4 -4
View File
@@ -6,7 +6,7 @@ Blocks the current fiber for the given amount of micro-seconds.
control.waitMicros(4)
```
### Example
## Example
This program sends a 10 micro-second HIGH pulse through pin ``P0``.
@@ -21,12 +21,12 @@ control.waitMicros(10)
pins.digitalWritePin(DigitalPin.P0, 0)
```
#### ~hint
### ~hint
This function is not supported in the simulator.
#### ~
### ~
### See Also
## See Also
[pause](/reference/basic/pause)
+1 -1
View File
@@ -22,6 +22,6 @@ devices.onSignalStrengthChanged(() => {
devices
```
### See Also
## See Also
[tellCameraTo](/reference/devices/tell-camera-to), [tellRemoteControlTo](/reference/devices/tell-remote-control-to), [raiseAlertTo](/reference/devices/raise-alert-to), [onNotified](/reference/devices/on-notified), [onGamepadButton](/reference/devices/on-gamepad-button), [signalStrength](/reference/devices/signal-strength), [onSignalStrengthChanged](/reference/devices/on-signal-strength-changed)
+4 -4
View File
@@ -2,22 +2,22 @@
Register code to run when the @boardname@ receives a command from the paired gamepad.
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
```sig
devices.onGamepadButton(MesDpadButtonInfo.ADown, () => {})
```
### Parameters
## Parameters
* ``body``: Action code to run when the the @boardname@ receives a command from the paired gamepad.
### See Also
## See Also
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength), [on signal strength changed](/reference/devices/on-signal-strength-changed)
+5 -5
View File
@@ -2,12 +2,12 @@
Register code to run when the signal strength of the paired device changes.
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
@@ -15,11 +15,11 @@ For another device like a smartphone to use any of the Bluetooth "services" whic
devices.onNotified(MesDeviceInfo.IncomingCall, () => {})
```
### Parameters
## Parameters
* ``body``: code to run when the signal strength changes.
### Examples
## Examples
Display the signal strength on screen:
@@ -29,7 +29,7 @@ devices.onNotified(MesDeviceInfo.IncomingCall, () => {
})
```
### See Also
## See Also
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength)
@@ -2,12 +2,12 @@
Register code to run when the signal strength of the paired device changes.
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
@@ -15,11 +15,11 @@ For another device like a smartphone to use any of the Bluetooth "services" whic
devices.onSignalStrengthChanged(() => {})
```
### Parameters
## Parameters
* ``body``: code to run when the signal strength changes.
### Examples
## Examples
Display the signal strength on screen:
@@ -29,7 +29,7 @@ devices.onSignalStrengthChanged(() => {
})
```
### See Also
## See Also
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength)
+5 -5
View File
@@ -2,12 +2,12 @@
Raise an alert on a remote device.
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
@@ -15,11 +15,11 @@ For another device like a smartphone to use any of the Bluetooth "services" whic
devices.raiseAlertTo(MesAlertEvent.Vibrate)
```
### Parameters
## Parameters
* event - an event identifier
### Examples
## Examples
To tell the connected device to display toast
@@ -57,7 +57,7 @@ To tell the connected device to ring alarm
devices.raiseAlertTo(MesAlertEvent.RingAlarm)
```
### See also
## See also
[tell remote control to](/reference/devices/tell-remote-control-to), [tell camera to](/reference/devices/tell-camera-to)
+5 -5
View File
@@ -2,23 +2,23 @@
Returns the signal strength reported by the paired device from ``0`` (no signal) to ``4`` (full strength).
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
```sig
devices.signalStrength();
```
### Returns
## Returns
* the signal strength from ``0`` (no signal) to ``4`` (full strength).
### Examples
## Examples
Display the signal strength on screen:
@@ -28,7 +28,7 @@ devices.onSignalStrengthChanged(() => {
})
```
### See Also
## See Also
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [on signal strength changed](/reference/devices/on-signal-strength-changed)
+5 -5
View File
@@ -2,23 +2,23 @@
Access the photo/video-taking functionality of a remote device using the ``tell camera to`` function.
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
```sig
devices.tellCameraTo(MesCameraEvent.TakePhoto)
```
### Parameters
## Parameters
* event - an event identifier
### Examples
## Examples
To tell the connected device to take a picture:
@@ -68,7 +68,7 @@ To tell the connected device to stop video mode
devices.tellCameraTo(MesCameraEvent.StopVideoMode)
```
### See Also
## See Also
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to)
@@ -2,23 +2,23 @@
Control the presentation of media content available on a remote device using the `tell remote control` to function.
### ~hint
## ~hint
![](/static/bluetooth/Bluetooth_SIG.png)
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
### ~
## ~
```sig
devices.tellRemoteControlTo(MesRemoteControlEvent.play)
```
### Parameters
## Parameters
* event - an event identifier
### Event values
## Event values
* play
* stop
@@ -30,7 +30,7 @@ devices.tellRemoteControlTo(MesRemoteControlEvent.play)
* previous track
* next track
### Examples
## Examples
To tell the connected device to start playing:
@@ -80,7 +80,7 @@ To tell the connected device volume down
devices.tellRemoteControlTo(MesRemoteControlEvent.volumeDown)
```
### See also
## See also
[tell camera to](/reference/devices/tell-camera-to), [raise alert to](/reference/devices/raise-alert-to)
+5 -5
View File
@@ -4,7 +4,7 @@ Event handlers - how they work.
An event handler is code that is associated with a particular event, such as "button A pressed". You create (or register) the association between an event and an event handler by calling a function named "on <event>". After registering an event handler with an event, then whenever that event occurs, the event handler code executes.
### Registering an event handler
## Registering an event handler
Functions named "on <event>" create an association between an event and the event handler code. For example, the following code registers the event handler (the code between the `do` and `end` keywords) with the event of a press of button A:
@@ -16,7 +16,7 @@ input.onButtonPressed(Button.A, () => {
After this code executes, then whenever button A is pressed in the future, the string "hello" will be printed.
### Event handlers are active for the entire program execution
## Event handlers are active for the entire program execution
Once you have registered an event handler for an event, like above, that event handler is active for the rest of the program execution. If you want to stop the string "hello" from printing each time button A is pressed then you need to arrange for the following code to execute:
@@ -27,7 +27,7 @@ input.onButtonPressed(Button.A, () => {
The above code associated an event handler that does nothing with the event of a press of button A.
### There is only one event handler per event
## There is only one event handler per event
The above example also illustrates that there is only one event handler for each event. What is the result of the following code?
@@ -49,11 +49,11 @@ input.onButtonPressed(Button.A, () => {
})
```
### To learn more
## To learn more
To learn more about how the @boardname@ queues up and schedules event handlers, see [the @boardname@ - a reactive system](/device/reactive)
### see also
## see also
[on button pressed](/reference/input/on-button-pressed), [on pin up](/reference/input/on-pin-pressed), [on shake](/reference/input/on-gesture)
+1 -1
View File
@@ -34,7 +34,7 @@ game.pause();
game.resume();
```
### See also
## See also
[create sprite](/reference/game/create-sprite), [move](/reference/game/move), [turn](/reference/game/turn),
[ifOnEdgeBounce](/reference/game/if-on-edge-bounce), [get](/reference/game/get), [set](/reference/game/set),
+27
View File
@@ -0,0 +1,27 @@
# Change Score By
Add the amount you say to the score for the game.
```sig
game.addScore(1)
```
## Parameters
* a [number](/types/number) that means how much to add to the score. A negative number means to subtract from the score.
## Examples
This program is a simple game.
Press button ``A`` as much as possible.
At the end of 10 seconds, the program will show your score.
```blocks
input.onButtonPressed(Button.A, () => {
game.addScore(1)
})
game.startCountdown(10000)
```
## See Also
[score](/reference/game/score), [start countdown](/reference/game/start-countdown)
+3 -3
View File
@@ -7,7 +7,7 @@ let item: game.LedSprite = null;
item.change(LedSpriteProperty.X, 0);
```
### Parameters
## Parameters
* the **sprite** you want to change
* the kind of [number](/types/number) you want to change for the sprite, like
@@ -17,7 +17,7 @@ item.change(LedSpriteProperty.X, 0);
* ``brightness``, how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function)
* ``blink``, how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)
### Example
## Example
This program makes a sprite on the left side of the screen,
waits two seconds (2000 milliseconds),
@@ -29,7 +29,7 @@ basic.pause(2000);
ball.change(LedSpriteProperty.X, 2);
```
### See also
## See also
[turn](/reference/game/turn),
[brightness](/reference/led/brightness),
+4 -4
View File
@@ -4,17 +4,17 @@ The clear function for images.
Turn off all the pixels in an [Image](/reference/images/image).
### JavaScript
## JavaScript
```sig
export function clear(img: micro_bit.Image)
```
### Parameters
## Parameters
* none
### Example
## Example
The following example turns off the pixels of `img` when the A input button is pressed:
@@ -33,7 +33,7 @@ input.onButtonPressed(Button.A, () => {
})
```
### See also
## See also
[Image](/reference/images/image), [show animation](/reference/basic/show-animation), [show image](/reference/images/show-image), [scroll image](/reference/images/scroll-image), [create image](/reference/images/create-image)
+3 -3
View File
@@ -10,14 +10,14 @@ into another sprite.
game.createSprite(2, 2);
```
### Parameters
## Parameters
* ``x``: The left-to-right place on the LED screen where the sprite will start out.
* ``y``: The top-to-bottom place on the LED screen where the sprite will start out.
`0` and `4` mean the edges of the screen, and `2` means in the middle.
### Example
## Example
This program starts a sprite in the middle of the screen.
Next, the sprite turns toward the lower-right corner.
@@ -29,7 +29,7 @@ item.turn(Direction.Right, 45);
item.move(2);
```
### See also
## See also
[move](/reference/game/move),
[turn](/reference/game/turn),
+2 -2
View File
@@ -6,7 +6,7 @@ End the game and show the score.
game.gameOver();
```
### Example
## Example
This program asks you to pick a button.
If you press button `A`, the program says `YOU WIN!`.
@@ -22,7 +22,7 @@ input.onButtonPressed(Button.B, () => {
});
```
### See Also
## See Also
[score](/reference/game/score),
[add score](/reference/game/add-score), [start countdown](/reference/game/start-countdown)
+4 -4
View File
@@ -7,7 +7,7 @@ let item: game.LedSprite = null;
item.get(LedSpriteProperty.X);
```
### Parameters
## Parameters
* the **sprite** you want to know something about
* the kind of [number](/types/number) you want to know about the sprite, like
@@ -17,11 +17,11 @@ item.get(LedSpriteProperty.X);
* ``brightness``, how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function)
* ``blink``, how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)
### Returns
## Returns
The [number](/types/number) you asked for.
### Example
## Example
This program makes a sprite and shows the number of its brightness on the screen.
@@ -30,7 +30,7 @@ let ball = game.createSprite(0, 2);
basic.showNumber(ball.get(LedSpriteProperty.Brightness));
```
### See also
## See also
[turn](/reference/game/turn),
[brightness](/reference/led/brightness),
+3 -3
View File
@@ -8,11 +8,11 @@ let item = game.createSprite(0, 2);
item.ifOnEdgeBounce();
```
### Parameters
## Parameters
* a **sprite** that might be on the edge of the LED screen.
### Example
## Example
This program makes a sprite on the right edge of the screen with a
direction of 90 degrees, and bounces it so it has a direction of -90
@@ -27,7 +27,7 @@ input.onButtonPressed(Button.B, () => {
});
```
### See also
## See also
[create sprite](/reference/game/create-sprite),
[is touching](/reference/game/is-touching),
+4 -4
View File
@@ -10,15 +10,15 @@ let item: game.LedSprite = null;
item.isTouchingEdge();
```
### Parameters
## Parameters
* a **sprite** that might be touching the edge of the screen
### Returns
## Returns
`true` if the sprite is touching the edge of the screen
### Example
## Example
This program makes a sprite in the middle of the left edge of the LED screen.
Then it says `EDGY!` if it's on the edge (which it is!), and `SAFE!` if it's
@@ -33,7 +33,7 @@ if (item.isTouchingEdge()) {
}
```
### See also
## See also
[create sprite](/reference/game/create-sprite),
[is touching](/reference/game/is-touching),
+4 -4
View File
@@ -9,16 +9,16 @@ let item: game.LedSprite = null;
item.isTouching(null);
```
### Parameters
## Parameters
* a **sprite** you are checking
* another **sprite** that might be touching the one you are checking
### Returns
## Returns
`true` if the two sprites are touching.
### Example
## Example
This program creates two sprites called ``matter`` and ``antimatter``,
and then checks whether they are touching. If they are, there is an
@@ -34,7 +34,7 @@ if (matter.isTouching(antimatter)) {
}
```
### See also
## See also
[create sprite](/reference/game/create-sprite),
[is touching edge](/reference/game/is-touching-edge),
+3 -3
View File
@@ -7,11 +7,11 @@ let item: game.LedSprite = null;
item.move(1);
```
### Parameters
## Parameters
* a [number](/types/number) that means how many LEDs the sprite should move
### Example
## Example
This program starts a sprite in the middle of the screen.
Next, the sprite turns toward the lower-right corner.
@@ -23,7 +23,7 @@ item.turn(Direction.Right, 45);
item.move(2);
```
### See also
## See also
[turn](/reference/game/turn),
[create sprite](/reference/game/create-sprite)
+2 -2
View File
@@ -6,7 +6,7 @@ Find the number of points scored in your game.
game.score()
```
### Example
## Example
This program adds one point to your score every time you press button
`A`, and shows an animation. Then it waits 500 milliseconds (half a
@@ -20,6 +20,6 @@ input.onButtonPressed(Button.A, () => {
});
```
### See Also
## See Also
[change score by](/reference/game/score), [start countdown](/reference/game/start-countdown)
+3 -3
View File
@@ -5,11 +5,11 @@ Sets the current score.
```sig
game.setScore(1)
```
### Parameters
## Parameters
* a [number](/types/number) that represents the new score.
### Examples
## Examples
This program is a simple game.
Press button ``A`` as much as possible to increase the score.
@@ -25,6 +25,6 @@ input.onButtonPressed(Button.A, () => {
})
```
### See Also
## See Also
[score](/reference/game/score), [add score](/reference/game/add-score), [start countdown](/reference/game/start-countdown)
+3 -3
View File
@@ -7,7 +7,7 @@ let item: game.LedSprite = null;
item.set(LedSpriteProperty.X, 0);
```
### Parameters
## Parameters
* the **sprite** you want to make store the number you say
* the kind of [number](/types/number) you want to store in the sprite, like
@@ -17,7 +17,7 @@ item.set(LedSpriteProperty.X, 0);
* ``brightness``, how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function)
* ``blink``, how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)
### Example
## Example
This program makes a sprite on the left side of the screen,
waits two seconds (2000 milliseconds),
@@ -29,7 +29,7 @@ basic.pause(2000);
ball.set(LedSpriteProperty.X, 4);
```
### See also
## See also
[turn](/reference/game/turn),
[brightness](/reference/led/brightness),
+3 -3
View File
@@ -6,11 +6,11 @@ Start counting down time from the number of milliseconds you say.
game.startCountdown(1000)
```
### Parameters
## Parameters
* ``ms`` is a [number](/types/number) that says how many milliseconds to count down (one second is 1000 milliseconds)
### Examples
## Examples
This program is a simple game.
Press button ``A`` as much as possible.
@@ -23,7 +23,7 @@ input.onButtonPressed(Button.A, () => {
game.startCountdown(10000)
```
### See Also
## See Also
[score](/reference/game/score), [add score](/reference/game/add-score)
+3 -3
View File
@@ -7,13 +7,13 @@ let item: game.LedSprite = null;
item.turn(Direction.Right, 45);
```
### Parameters
## Parameters
* a choice whether the sprite should turn **left** or **right**
* a [number](/types/number) that means how much the sprite should turn.
This number is in **degrees**, so a straight left or right turn is 90 degrees.
### Example
## Example
This program starts a sprite in the middle of the screen.
@@ -26,7 +26,7 @@ item.turn(Direction.Right, 45);
item.move(2);
```
### See also
## See also
[move](/reference/game/move),
+1 -1
View File
@@ -24,7 +24,7 @@ images.iconImage(IconNames.Heart)
images.arrowNumber(ArrowNames.North)
```
### See Also
## See Also
[createImage](/reference/images/create-image), [createBigImage](/reference/images/create-big-image),
[showImage](/reference/images/show-image), [scrollImage](/reference/images/scroll-image),
+3 -3
View File
@@ -14,13 +14,13 @@ images.createBigImage(`
`);
```
### Parameters
## Parameters
* ``leds`` is a [string](/types/string) that says which LEDs
on the screen should be on and which should be off.
### Example: Flip-flopping arrow
## Example: Flip-flopping arrow
This program makes a big image with a picture of an arrow pointing up,
and an arrow pointing down. If you press button `A`, the program will
@@ -44,7 +44,7 @@ input.onButtonPressed(Button.B, () => {
});
```
### See also
## See also
[image](/reference/images/image),
[create image](/reference/images/create-image),
+3 -3
View File
@@ -13,12 +13,12 @@ images.createImage(`
`)
```
### Parameters
## Parameters
* ``leds`` is a [string](/types/string) that says which LEDs
on the screen should be on and which should be off.
### Example: Flip-flopping arrow
## Example: Flip-flopping arrow
If you press button `A`, this program will make a picture of an
arrow and show it on the LED screen. If you press button `B`, the
@@ -45,7 +45,7 @@ input.onButtonPressed(Button.B, () => {
});
```
### See also
## See also
[image](/reference/images/image),
[create big image](/reference/images/create-big-image),
+5 -5
View File
@@ -2,11 +2,11 @@
An image for the @boardname@ screen.
### @parent blocks/language
## @parent blocks/language
An *Image* is a matrix of pixels to show on the [LED screen](/device/screen)
### Block Editor: Show LEDs
## Block Editor: Show LEDs
To display an image:
@@ -22,7 +22,7 @@ basic.showLeds(`
`)
```
### Creating an image
## Creating an image
To create an image that you can later modify, see the [create image](/reference/images/create-image) function.
@@ -38,7 +38,7 @@ You should see code similar to this:
![](/static/mb/blocks/image-0.png)
### Image functions
## Image functions
* [create image](/reference/images/create-image): create an image from a series of on/off LED states
* [clear](/reference/basic/clear-screen): turn off all the pixels in an image
@@ -47,7 +47,7 @@ You should see code similar to this:
* [show image](/reference/images/show-image): show an image on the screen
* [scroll image](/reference/images/scroll-image): scroll an image on the screen
### See also
## See also
[Show LEDs](/reference/basic/show-leds), [create image](/reference/images/create-image), [show image](/reference/images/show-image), [LED screen](/device/screen)
+8 -8
View File
@@ -4,30 +4,30 @@ The pixel function.
Get the state of a pixel in an [Image](/reference/images/image).
### JavaScript
## JavaScript
```sig
export function pixel(_this: micro_bit.Image, x: number, y: number) : boolean
```
### Parameters
## Parameters
* x - [Number](/types/number); the *x coordinate* or horizontal position of a pixel in an [image](/reference/images/image)
* y - [Number](/types/number); the *y coordinate* or vertical position of a pixel in an [image](/reference/images/image)
### x, y coordinates?
## x, y coordinates?
To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
### Returns
## Returns
* [Boolean](/blocks/logic/boolean) - `true` for on and `false` for off
### Example
## Example
This example gets the state of pixel `0, 0` in the `img` variable:
### ~hide
## ~hide
```blocks
let img = images.createImage(`
@@ -39,13 +39,13 @@ let img = images.createImage(`
`)
```
### ~
## ~
```typescript-ignore
let state = img.pixel(0, 0)
```
### See also
## See also
[set pixel](/reference/images/set-pixel), [show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image)
+5 -5
View File
@@ -4,21 +4,21 @@ The plot frame function.
Display an [Image](/reference/images/image) on the @boardname@'s [LED screen](/device/screen)
### JavaScript
## JavaScript
```sig
export function plotFrame(_this: micro_bit.Image, index: number)
```
### Parameters
## Parameters
* index - [Number](/types/number); which frame of the image to display
### Difference from `plot image`
## Difference from `plot image`
The `plot frame` function takes the index of the frame (if there are two frames, then the possible indices are 0 and 1), whereas `plot image` accepts an offset (if there are two frames, the offset would range between 0 and 9).
### Example
## Example
```blocks
let img = images.createImage(`
@@ -31,7 +31,7 @@ let img = images.createImage(`
img.plotFrame(1)
```
### See also
## See also
[create image](/reference/images/create-image), [show animation](/reference/basic/show-animation), [image](/reference/images/image), [show image](/reference/images/show-image), [scroll image](/reference/images/scroll-image)
+5 -5
View File
@@ -4,21 +4,21 @@ The plot image function.
Display an [Image](/reference/images/image) on the @boardname@'s [LED screen](/device/screen)
### JavaScript
## JavaScript
```sig
export function plotImage(_this: micro_bit.Image, xOffset: number)
```
### Parameters
## Parameters
* x offset - [Number](/types/number); the horizontal starting point of an image; use 0 for the first frame of the image, 5 for the second frame of the image, 10 for the third frame and so on.
### Difference from `show image`
## Difference from `show image`
The `show image` function has a built in delay of 400ms after display of the image, whereas `plot image` has no built-in delay.
### Example
## Example
```blocks
let img = images.createImage(`
@@ -31,7 +31,7 @@ let img = images.createImage(`
img.plotImage(0)
```
### See also
## See also
[create image](/reference/images/create-image), [show animation](/reference/basic/show-animation), [image](/reference/images/image), [show image](/reference/images/show-image), [scroll image](/reference/images/scroll-image)
+3 -3
View File
@@ -8,7 +8,7 @@ let item: Image = null;
item.scrollImage(5, 200);
```
### Parameters
## Parameters
* a [number](/types/number) that means
how many LEDs to scroll at a time, from right to left or
@@ -25,7 +25,7 @@ item.scrollImage(5, 200);
``offset`` says. (1000 milliseconds is one second.) The bigger you
make this number, the slower the image will scroll.
### Example
## Example
This program scrolls an image of two arrows five LEDs at a time,
with a pause of 200 milliseconds between each time it scrolls.
@@ -47,7 +47,7 @@ basic.forever(() => {
});
```
### See also
## See also
[show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [show animation](/reference/basic/show-animation)
+5 -5
View File
@@ -4,23 +4,23 @@ The set pixel function. #set pixel.
Set the on/off state of pixel in an [Image](/reference/images/image).
### JavaScript
## JavaScript
```sig
export function setPixel(_this: micro_bit.Image, x: number, y: number, value: boolean)
```
### Parameters
## Parameters
* x - [Number](/types/number); the *x coordinate* or horizontal position of a pixel in an [image](/reference/images/image)
* x - [Number](/types/number); the *y coordinate* or vertical position of a pixel in an [image](/reference/images/image)
* value -[Boolean](/blocks/logic/boolean); the on/off state of a pixel; `true` for on, `false` for off
### x, y coordinates?
## x, y coordinates?
To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
### Example
## Example
The following example creates an image and stores it in the `img` variable. The `set pixel` function sets the centre pixel off, before `img` is shown using `show image`.
@@ -36,7 +36,7 @@ img.setPixel(2, 2, false)
img.showImage(0)
```
### See also
## See also
[pixel](/reference/images/pixel), [show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image)
+5 -5
View File
@@ -4,21 +4,21 @@ The show frame function.
Display an [Image](/reference/images/image) on the @boardname@'s [LED screen](/device/screen)
### JavaScript
## JavaScript
```sig
export function showFrame(img: micro_bit.Image, frame: number)
```
### Parameters
## Parameters
* index - [Number](/types/number); which frame of the image to display
### Difference from `plot frame`
## Difference from `plot frame`
The `show frame` function is the same as [plot frame](/reference/images/plot-frame), but contains a built-in delay after the LED screen has been updated (whereas `plot frame` has no built-in delay)
### Example
## Example
```blocks
let img = images.createImage(`
@@ -31,7 +31,7 @@ let img = images.createImage(`
img.showFrame(1)
```
### See also
## See also
[create image](/reference/images/create-image), [show animation](/reference/basic/show-animation), [image](/reference/images/image), [show image](/reference/images/show-image), [scroll image](/reference/images/scroll-image)
+3 -3
View File
@@ -9,12 +9,12 @@ let item: Image = null;
item.showImage(0);
```
### Parameters
## Parameters
* an [image](/reference/images/image) (picture). It is usually a square with five LEDs on a side, but it might be wider.
* a [number](/types/number) that says how many LEDs from the left of the picture the @boardname@ should start. `0` means start at the first **frame** of the picture, `5` means start at the second frame, `10` means start at the third, and so on.
### Example: Flip-flopping arrow
## Example: Flip-flopping arrow
This program makes a big image with a frame of an arrow pointing up,
and a frame of an arrow pointing down. If you press button `A`, the
@@ -39,7 +39,7 @@ input.onButtonPressed(Button.B, () => {
});
```
### See also
## See also
[image](/reference/images/image),
[create image](/reference/images/create-image),
+6 -6
View File
@@ -8,17 +8,17 @@ Get the width of an [Image](/reference/images/image) in columns.
images.createImage().width();
```
### Parameters
## Parameters
* none
### Returns
## Returns
* [Number](/types/number) - the number of columns in a image. This function returns 5 if the image has 1 frame, 10 for 2 frames, 15 for 3 frames and so on. Divide the number of columns by 5 to find out how many frames an image has (see example below).
The following example gets the width of `img` and stores it in the `w` variable:
### ~hide
## ~hide
```blocks
let img = images.createImage(`
@@ -30,13 +30,13 @@ let img = images.createImage(`
`)
```
### ~
## ~
```typescript-ignore
let w = img.width()
```
### Example: show each frame
## Example: show each frame
The following example uses the `width` function with a [for](/blocks/loops/for) loop to show each image frame on the screen:
@@ -54,7 +54,7 @@ for (let i = 0; i < img2.width() / 5; i++) {
}
```
### See also
## See also
[show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation)
+1 -1
View File
@@ -24,6 +24,6 @@ input.runningTime();
input.setAccelerometerRange(AcceleratorRange.OneG);
```
### See also
## See also
[onButtonPressed](/reference/input/on-button-pressed), [onGesture](/reference/input/on-gesture), [onPinPressed](/reference/input/on-pin-pressed), [buttonIsPressed](/reference/input/button-is-pressed), [compassHeading](/reference/input/compass-heading), [pinIsPressed](/reference/input/pin-is-pressed), [temperature](/reference/input/temperature), [acceleration](/reference/input/acceleration), [lightLevel](/reference/input/light-level), [rotation](/reference/input/rotation), [magneticForce](/reference/input/magnetic-force), [runningTime](/reference/input/running-time), [setAccelerometerRange](/reference/input/set-accelerometer-range), [calibrate-compass](/reference/input/calibrate-compass)
+4 -4
View File
@@ -15,7 +15,7 @@ A **g** is as much acceleration as you get from Earth's gravity.
## ~
### Parameters
## Parameters
* **dimension**: the direction you are checking for acceleration, or the total strength of force.
>`x`: acceleration in the left and right direction.<br/>
@@ -23,11 +23,11 @@ A **g** is as much acceleration as you get from Earth's gravity.
`z`: acceleration the up and down direction.<br/>
`strength`: the total of all the forces in every dimension (direction) together.
### Returns
## Returns
* a [number](/types/number) that means the amount of acceleration. When the @boardname@ is lying flat on a surface with the screen pointing up, `x` is `0`, `y` is `0`, `z` is `-1023`, and `strength` is `1023`.
### Example: bar chart
## Example: bar chart
This example shows the acceleration of the @boardname@ with a bar graph.
@@ -47,7 +47,7 @@ basic.forever(() => {
})
```
### See also
## See also
[set accelerometer range](/reference/input/set-accelerometer-range),
[compass heading](/reference/input/compass-heading),
+4 -4
View File
@@ -6,15 +6,15 @@ Check whether a button is pressed right now. The @boardname@ has two buttons: bu
input.buttonIsPressed(Button.A);
```
### Parameters
## Parameters
* ``button`` is a [String](/types/string). You should store `A` in it to check the left button, `B` to check the right button, or `A+B` to check both at the same time.
### Returns
## Returns
* [Boolean](/blocks/logic/boolean) that is `true` if the button you are checking is pressed, `false` if it is not pressed.
### Example
## Example
This program uses an [if](/blocks/logic/if) to run
one part of the program if the `A` button is pressed, and
@@ -33,7 +33,7 @@ basic.forever(() => {
})
```
### See also
## See also
[on button pressed](/reference/input/on-button-pressed), [if](/blocks/logic/if), [forever](/reference/basic/forever)
+3 -3
View File
@@ -6,7 +6,7 @@ Runs the compass calibration sequence.
input.calibrateCompass();
```
### Calibration
## Calibration
The calibration will ask you to draw a circle by tilting the
@boardname@.
@@ -14,7 +14,7 @@ The calibration will ask you to draw a circle by tilting the
If you are calibrating or using the compass near metal, it might
confuse the @boardname@.
### Example
## Example
This example runs the calibration when the user presses **A+B** buttons.
@@ -24,6 +24,6 @@ input.onButtonPressed(Button.AB, () => {
})
```
### See also
## See also
[compassHeading](/reference/input/compass-heading)
+9 -9
View File
@@ -10,11 +10,11 @@ east, south, and west.
input.compassHeading();
```
### Returns
## Returns
* a [number](/types/number) from `0` to `360` degrees, which means the compass heading. If the compass isn't ready, it returns `-1003`.
### Example
## Example
This program finds the compass heading and stores it in the
`degrees` variable.
@@ -23,14 +23,14 @@ This program finds the compass heading and stores it in the
let degrees = input.compassHeading()
```
### ~hint
## ~hint
When you run a program that uses this function in a browser, click and drag
the compass needle on the screen to change the compass heading.
### ~
## ~
### Example: compass
## Example: compass
This program finds the compass heading and then shows a letter
that means whether the @boardname@ is facing north (N), south (S),
@@ -49,7 +49,7 @@ basic.forever(() => {
})
```
### Calibration
## Calibration
Every time you start to use the compass (for example, if you have just
turned the @boardname@ on), the @boardname@ will start to [calibrateCompass](/reference/input/calibrate-compass)
@@ -59,7 +59,7 @@ turned the @boardname@ on), the @boardname@ will start to [calibrateCompass](/re
If you are calibrating or using the compass near metal, it might
confuse the @boardname@.
### ~ hint
## ~ hint
Keep the calibration handy by running it when the user pressed **A+B**.
@@ -69,8 +69,8 @@ input.onButtonPressed(Button.AB, () => {
})
```
### ~
## ~
### See also
## See also
[acceleration](/reference/input/acceleration), [calibrateCompass](/reference/input/calibrate-compass)
+4 -4
View File
@@ -14,11 +14,11 @@ has to be turned on first.
input.lightLevel();
```
### Returns
## Returns
* a [Number](/types/number) that means a light level from ``0`` (dark) to ``255`` (bright).
### Example: show light level
## Example: show light level
When you press button `B` on the microbit, this
program shows the light level
@@ -31,7 +31,7 @@ input.onButtonPressed(Button.B, () => {
})
```
### Example: chart light level
## Example: chart light level
This program shows the light level with a [bar chart](/reference/led/plot-bar-graph) on the @boardname@ screen.
If you carry the @boardname@ around to different places with different light levels,
@@ -43,7 +43,7 @@ basic.forever(() => {
})
```
### See also
## See also
[acceleration](/reference/input/acceleration), [compass-heading](/reference/input/compass-heading)
+4 -4
View File
@@ -13,18 +13,18 @@ The @boardname@ measures magnetic force with **microteslas**.
## ~
### Parameters
## Parameters
* ``dimension`` means which direction the @boardname@ should measure
magnetic force in: either `Dimension.X` (the left-right direction),
`Dimension.Y` (the forward/backward direction), or `Dimension.Z`
(the up/down direction)
### Returns
## Returns
* a [number](/types/number) of microteslas that means the strength of the magnet
### Example: metal detector
## Example: metal detector
This program makes the center LED of the @boardname@ get brighter when
the magnetic force is stronger, and dimmer when it is weaker.
@@ -37,6 +37,6 @@ basic.forever(() => {
})
```
### See also
## See also
[compass heading](/reference/input/compass-heading)
+5 -5
View File
@@ -12,7 +12,7 @@ on the @boardname@.
input.onButtonPressed(Button.A, () => {})
```
### Example: count button clicks
## Example: count button clicks
This example counts how many times you press the `A` button.
Each time you press the button, the [LED screen](/device/screen) shows the `count` variable getting bigger.
@@ -26,7 +26,7 @@ input.onButtonPressed(Button.A, () => {
})
```
### Example: roll dice
## Example: roll dice
This example shows a number from 1 to 6 when you press the `B` button.
@@ -37,14 +37,14 @@ input.onButtonPressed(Button.B, () => {
})
```
### ~hint
## ~hint
This program adds a `1` to `random(6)` so the numbers on the dice will come out right.
Otherwise, sometimes they would show a `0`.
### ~
## ~
### See also
## See also
[button is pressed](/reference/input/button-is-pressed), [forever](/reference/basic/forever), [random](/blocks/math)
+2 -2
View File
@@ -9,11 +9,11 @@ input.onGesture(Gesture.Shake,() => {
})
```
### Parameters
## Parameters
* ``gesture`` means the way you hold or move the @boardname@. This can be `shake`, `logo up`, `logo down`, `screen up`, `screen down`, `tilt left`, `tilt right`, `free fall`, `3g`, or `6g`.
### Example: random number
## Example: random number
This program shows a number from `0` to `9` when you shake the @boardname@.
+2 -2
View File
@@ -29,7 +29,7 @@ instead of the USB cable.
* ``name`` means the pin that is being pressed, either `P0`, `P1`, or `P2`
### Example: pin pressed counter
## Example: pin pressed counter
This program counts how many times you press the `P0` pin.
Every time you press the pin, the program shows the number of times on the screen.
@@ -43,7 +43,7 @@ input.onPinPressed(TouchPin.P0, () => {
})
```
### See also
## See also
[@boardname@ pins](/device/pins), [pin is pressed](/reference/input/pin-is-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)
+2 -2
View File
@@ -28,7 +28,7 @@ instead of the USB cable.
* ``name`` means the pin that is being released, either `P0`, `P1`, or `P2`
### Example: pin pressed counter
## Example: pin pressed counter
This program counts how many times you release the `P0` pin.
Every time you release the pin, the program shows the number of times on the screen.
@@ -42,7 +42,7 @@ input.onPinReleased(TouchPin.P0, () => {
})
```
### See also
## See also
[@boardname@ pins](/device/pins), [pin is pressed](/reference/input/pin-is-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)
+4 -4
View File
@@ -17,15 +17,15 @@ instead of the USB cable.
## ~
### Parameters
## Parameters
* a [string](/types/string) that holds the pin name (**P0**, **P1**, or **P2**)
### returns
## returns
* a [boolean](/blocks/logic/boolean) that means whether the pin you say is pressed (`true` or `false`)
### Example
## Example
This program shows `1` if `P0` is pressed, and `0` if `P0` is not pressed:
@@ -39,7 +39,7 @@ basic.forever(() => {
})
```
### See also
## See also
[@boardname@ pins](/device/pins), [on pin pressed](/reference/input/on-pin-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)
+4 -4
View File
@@ -13,15 +13,15 @@ check how the @boardname@ is moving.
## ~
### Parameters
## Parameters
* ``kind`` means which direction you are checking: `Rotation.Pitch` (up and down) or `Rotation.Roll` (left and right)
### Returns
## Returns
* a [number](/types/number) that means how much the microbit is tilted in the direction you say, from `0` to `360` degrees
### Example: @boardname@ leveler
## Example: @boardname@ leveler
This program helps you move the @boardname@ until it is level. When
it is level, the @boardname@ shows a smiley.
@@ -55,7 +55,7 @@ basic.forever(() => {
});
```
### See also
## See also
[acceleration](/reference/input/acceleration), [compass-heading](/reference/input/compass-heading)
+3 -3
View File
@@ -6,12 +6,12 @@ Find how long it has been since the program started.
input.runningTime();
```
### Returns
## Returns
* the [Number](/types/number) of milliseconds since the program started.
(One second is 1000 milliseconds.)
### Example: elapsed time
## Example: elapsed time
When you press button `B` on the microbit, this
program finds the number of milliseconds since the program started
@@ -25,7 +25,7 @@ input.onButtonPressed(Button.B, () => {
```
### See also
## See also
[show number](/reference/basic/show-number), [pause](/reference/basic/pause)
@@ -9,14 +9,14 @@ or low acceleration.
input.setAccelerometerRange(AcceleratorRange.OneG);
```
### Parameters
## Parameters
* ``range`` means the biggest number of gravities of acceleration you
will be measuring (either `1g`, `2g`, `4g`, or `8g`). Any bigger numbers
will be ignored by your @boardname@, both when you are picking a
number of gravities, and when you are measuring acceleration.
### Example
## Example
This program sets the highest acceleration that your @boardname@
will measure is 4G. Then it shows acceleration from side to side
@@ -29,13 +29,13 @@ basic.forever(() => {
});
```
#### ~hint
### ~hint
This program does not work in the simulator, only in a @boardname@.
#### ~
### ~
### See Also
## See Also
[compass heading](/reference/input/compass-heading),
[light level](/reference/input/light-level)
+7 -7
View File
@@ -7,18 +7,18 @@ The @boardname@ can find the temperature nearby by checking how hot its computer
input.temperature();
```
### Returns
## Returns
* a [Number](/types/number) that means the Celsius temperature.
### How does it work?
## How does it work?
The @boardname@ checks how hot its CPU (main computer chip) is.
Because the @boardname@ does not usually get very hot, the temperature of the CPU
is usually close to the temperature of wherever you are.
The @boardname@ might warm up a little if you make it work hard, though!
### Example: @boardname@ thermometer
## Example: @boardname@ thermometer
The following example uses `temperature` and `show number` to show the temperature of the room.
@@ -28,7 +28,7 @@ basic.forever(() => {
basic.showNumber(temp)
})
```
### Example: Fahrenheit thermometer
## Example: Fahrenheit thermometer
This program measures the temperature using Fahrenheit degrees.
Fahrenheit is a way of measuring temperature that is commonly used in the United States.
@@ -43,16 +43,16 @@ basic.forever(() => {
})
```
### ~hint
## ~hint
Try comparing the temperature your @boardname@ shows to a real thermometer in the same place.
You might be able to figure out how much to subtract from the number the @boardname@
shows to get the real temperature. Then you can change your program so the @boardname@ is a
better thermometer.
### ~
## ~
### See also
## See also
[compass-heading](/reference/input/compass-heading), [acceleration](/reference/input/acceleration)
+1 -1
View File
@@ -21,7 +21,7 @@ led.setDisplayMode(DisplayMode.BackAndWhite);
led.enable(false)
```
### See Also
## See Also
[plot](/reference/led/plot), [unplot](/reference/led/unplot), [point](/reference/led/point), [brightness](/reference/led/brightness), [setBrightness](/reference/led/set-brightness), [stopAnimation](/reference/led/stop-animation), [plotBarGraph](/reference/led/plot-bar-graph), [fadeIn](/reference/led/fade-in), [fadeOut](/reference/led/fade-out), [plotAll](/reference/led/plot-all), [screenshot](/reference/led/screenshot), [toggle](/reference/led/toggle), [toggleAll](/reference/led/toggle-all), [setDisplayMode](/reference/led/set-display-mode), [enabled](/reference/led/enable),
[plotBrightness](/reference/led/plot-brightness),
+4 -4
View File
@@ -6,11 +6,11 @@ Find how bright the [LED screen](/device/screen) is _when it is turned on_.
led.brightness();
```
### Returns
## Returns
* a [number](/types/number) that means how bright the screen is when it is turned on, from `0` (darkest) to `255` (brightest). For example, the number `127` means the screen is halfway bright when it is turned on.
### Example: highest brightness
## Example: highest brightness
This program makes the screen completely bright when it is turned on (if it is not that way already):
@@ -21,7 +21,7 @@ if (led.brightness() < 255) {
```
### Example: change brightness
## Example: change brightness
This program makes the screen brightness 100% (255). Then it turns on
the center LED (`2, 2`), waits for one second and then sets the screen
@@ -34,7 +34,7 @@ basic.pause(1000)
led.setBrightness(led.brightness() / 2)
```
### See also
## See also
[set brightness](/reference/led/set-brightness), [fade in](/reference/led/fade-in), [fade out](/reference/led/fade-out)
+4 -4
View File
@@ -6,11 +6,11 @@ Turns the LED screen on and off
led.enable(false);
```
### Parameters
## Parameters
* ``on`` is a [boolean](/types/boolean) that defines the on/off state of the screen
### Example: Turning off the screen
## Example: Turning off the screen
This program turns off the screen when pressing button ``B``
@@ -20,7 +20,7 @@ input.onButtonPressed(Button.B, () => {
});
```
### 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.
To disable the display driver feature (which will automatically disable the light sensing feature) call the DAL function ``led.enable(false)``.
@@ -28,6 +28,6 @@ To turn the display driver back on again later, call ``led.enable(true)``.
More information at http://tech.microbit.org/hardware/edgeconnector_ds/ .
### See also
## See also
[unplot](/reference/led/unplot), [point](/reference/led/point), [LED screen](/device/screen)
+3 -3
View File
@@ -6,11 +6,11 @@ Gradually increase the [LED screen](/device/screen) brightness until the LED lig
led.fadeIn(700);
```
### Parameters
## Parameters
* ms - [Number](/types/number); the speed by which the screen brightness is increased, expressed in milliseconds (1,000 milliseconds = 1 second). The smaller the number the faster the screen brightness increased.
### Example: fading dot
## Example: fading dot
The following code turns on centre LED and then gradually increases and decreases the screen brightness (the centre LED pulses 5 times):
@@ -24,7 +24,7 @@ for (let i = 0; i < 5; i++) {
}
```
### See also
## See also
[brightness](/reference/led/brightness), [fade out](/reference/led/fade-out), [set brightness](/reference/led/set-brightness)
+3 -3
View File
@@ -6,11 +6,11 @@ Gradually decrease the [LED screen](/device/screen) brightness until the LED lig
led.fadeOut(700);
```
### Parameters
## Parameters
* ms - [Number](/types/number); the speed that the screen brightness is decreased, expressed in milliseconds (1,000 milliseconds = 1 second). The smaller the number the faster the screen brightness decreased.
### Example: fade away letter A
## Example: fade away letter A
The following example sets the screen brightness to the maximum brightness, displays the letter A, and then gradually fades the letter away:
@@ -20,7 +20,7 @@ basic.showString("A", 1000)
led.fadeOut(1000)
```
### See also
## See also
[brightness](/reference/led/brightness), [fade in](/reference/led/fade-in), [set brightness](/reference/led/set-brightness)
+1 -1
View File
@@ -6,7 +6,7 @@ Turn on all the 25 LEDs on the [LED screen](/device/screen).
led.plotAll()
```
### See also
## See also
[LED screen](/device/screen), [clear screen](/reference/basic/clear-screen)
+3 -3
View File
@@ -7,7 +7,7 @@ A bar graph is a kind of chart that shows numbers as lines with different length
led.plotBarGraph(2, 20);
```
### Parameters
## Parameters
* ``value`` is a [number](/types/number) that means what you
are measuring or trying to show. For example, if you are measuring
@@ -17,7 +17,7 @@ led.plotBarGraph(2, 20);
possible number that the ``value`` parameter can be. This number is
also the tallest that the lines in the bar chart can be.
### Example: chart acceleration
## Example: chart acceleration
This program shows a bar graph of the [acceleration](/reference/input/acceleration)
in the `x` direction of the @boardname@.
@@ -33,7 +33,7 @@ basic.forever(() => {
})
```
### See also
## See also
[brightness](/reference/led/brightness), [fade in](/reference/led/fade-in), [fade out](/reference/led/fade-out), [LED screen](/device/screen), [stop animation](/reference/led/stop-animation)
+8 -8
View File
@@ -12,7 +12,7 @@ Use [unplot](/reference/led/unplot) to turn **off** an LED.
## ~
### Parameters
## Parameters
* ``x`` is a [number](/types/number) that means the
horizontal spot on the LED screen (from left to right: 0, 1, 2, 3,
@@ -23,15 +23,15 @@ Use [unplot](/reference/led/unplot) to turn **off** an LED.
If a parameter is [out of bounds](/reference/out-of-bounds) (a value
other than 0 to 4), then this function will do nothing.
### ~hint
## ~hint
The LED screen is a solid square of LEDs with five LEDs on each side.
To learn more about how you number the LEDs with ``x`` and ``y``
coordinates, see [LED screen](/device/screen).
### ~
## ~
### Example: One LED
## Example: One LED
This program turns on the bottom right LED.
@@ -40,7 +40,7 @@ led.plot(4, 4)
```
### Example: Square
## Example: Square
This program uses a [for loop](/blocks/loops/for)
and the `plot` function
@@ -56,13 +56,13 @@ for (let i = 0; i < 5; i++) {
}
```
### ~hint
## ~hint
Use the [point](/reference/led/point) function to find out if an LED is
on or off.
### ~
## ~
### See also
## See also
[unplot](/reference/led/unplot), [point](/reference/led/point), [LED screen](/device/screen)
+6 -6
View File
@@ -7,7 +7,7 @@ Find whether the LED you say on the
led.point(0,0);
```
### Parameters
## Parameters
* ``x`` is a [number](/types/number) that means the
horizontal spot on the LED screen (from left to right: 0, 1, 2, 3,
@@ -18,19 +18,19 @@ led.point(0,0);
If a parameter is [out of bounds](/reference/out-of-bounds) (a value
other than 0 to 4), this function will return `false`.
### Returns
## Returns
* a [boolean](/blocks/logic/boolean). If it is `true`, that means the LED is on. If it is `false`, that means the LED is off.
### ~hint
## ~hint
The LED screen is a solid square of LEDs with five LEDs on each side.
To learn more about how you number the LEDs with ``x`` and ``y``
coordinates, see [LED screen](/device/screen).
### ~
## ~
### Example: Toggle off
## Example: Toggle off
This program turns the center LED (2, 2) off if it is already on. (If
it is already off, this program leaves it off.)
@@ -41,7 +41,7 @@ if (led.point(2, 2)) {
}
```
### See also
## See also
[unplot](/reference/led/unplot), [plot](/reference/led/plot), [LED screen](/device/screen)
+3 -3
View File
@@ -6,15 +6,15 @@ Make an [Image](/reference/images/image) out of the current state of the [LED sc
led.screenshot();
```
### Parameters
## Parameters
* none
### Returns
## Returns
* an [Image](/reference/images/image) of what is currently visible on the [LED screen](/device/screen)
### See also
## See also
[create image](/reference/images/create-image), [LED screen](/device/screen),

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