@ -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.
|
||||
|
||||

|
||||
|
||||
### 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).
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -1,13 +1,13 @@
|
||||
# Bluetooth Pairing
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||

|
||||
|
||||
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### 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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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)
|
||||
|
||||
|
@ -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, () => {
|
||||
|
@ -1,11 +1,11 @@
|
||||
# UART Read
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||

|
||||
|
||||
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
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
|
||||

|
||||
|
||||
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
|
||||

|
||||
|
||||
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)
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
# UART Write Value
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||

|
||||
|
||||
For another device like a smartphone to use any of the Bluetooth "services" which the @boardname@ has, it must first be [paired with the @boardname@](/reference/bluetooth/bluetooth-pairing). Once paired, the other device may connect to the @boardname@ and exchange data relating to many of the @boardname@'s features.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
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)
|
||||
|
||||
|
Reference in New Issue
Block a user