From b150ee873fd06f0af12e17ef8745ecdb1b63c85e Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Wed, 22 Jun 2016 09:25:01 -0700 Subject: [PATCH] updated bluetooth docs --- .../bluetooth/on-bluetooth-disconnected.md | 26 +++++++++++-------- .../bluetooth/start-accelerometer-service.md | 24 ++++++++++------- .../bluetooth/start-button-service.md | 24 ++++++++++------- .../bluetooth/start-io-pin-service.md | 24 ++++++++++------- docs/reference/bluetooth/start-led-service.md | 24 ++++++++++------- .../bluetooth/start-magnetometer-service.md | 23 +++++++++------- .../bluetooth/start-temperature-service.md | 24 ++++++++++------- 7 files changed, 100 insertions(+), 69 deletions(-) diff --git a/docs/reference/bluetooth/on-bluetooth-disconnected.md b/docs/reference/bluetooth/on-bluetooth-disconnected.md index 34674e83..3bfd3859 100755 --- a/docs/reference/bluetooth/on-bluetooth-disconnected.md +++ b/docs/reference/bluetooth/on-bluetooth-disconnected.md @@ -1,33 +1,37 @@ # On Bluetooth Disconnected +### ~hint ![](/static/bluetooth/Bluetooth_SIG.png) -For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first connect to the micro:bit. This block starts an [event handler](/reference/event-handler) which in this case will run when a device which is connected to your micro:bit over Bluetooth disconnects. +For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first connect to the micro:bit. + +### ~ + +This block starts an [event handler](/reference/event-handler) which in this case will run when a device which is connected to your micro:bit over Bluetooth disconnects. You could use this event handler to display a letter "D" on the micro:bit LED grid so you know that the Bluetooth connection has been closed. -~~~~sig +```sig bluetooth.onBluetoothDisconnected(() => { }); -~~~~ +``` ### Example: Displaying "D" when a Bluetooth connection to the micro:bit is closed -~~~~blocks +```blocks bluetooth.onBluetoothDisconnected(() => { basic.showString("D"); }); -~~~~ +``` ### Video - on Bluetooth disconnected -[![micro:bit Bluetooth demo video](/static/bluetooth/microbit_on_disconnected.png)]( - http://www.youtube.com/watch?v=HyBcsD9Eh6I "Click to launch YouTube video" - ) +http://www.youtube.com/watch?v=HyBcsD9Eh6I ### See also -[Bluetooth SIG](https://www.bluetooth.com) - -[Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +[Bluetooth SIG](https://www.bluetooth.com), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +```package +microbit-bluetooth +``` diff --git a/docs/reference/bluetooth/start-accelerometer-service.md b/docs/reference/bluetooth/start-accelerometer-service.md index 2c8ddec6..140c3f77 100755 --- a/docs/reference/bluetooth/start-accelerometer-service.md +++ b/docs/reference/bluetooth/start-accelerometer-service.md @@ -1,30 +1,33 @@ # Bluetooth Accelerometer Service +### ~hint ![](/static/bluetooth/Bluetooth_SIG.png) +For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first connect to the micro:bit. + +### ~ + The Bluetooth accelerometer service allows another device such as a smartphone to wirelessly receive data from the micro:bit'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. Using the Bluetooth accelerometer service you could, for example, create a smartphone application which makes a loud noise whenever your micro:bit (or the important thing you've attached it to) is moved. Or you could use your micro:bit to control the movement of a cartoon character in a game on your smartphone just by tilting the micro:bit in the direction you want the character to move in. No additional code is needed on the micro:bit to use the Bluetooth accelerometer service from another device. -~~~~sig +```sig bluetooth.startAccelerometerService(); -~~~~ +``` ### Example: Starting the Bluetooth accelerometer service The following code shows the Bluetooth accelerometer service being started: -~~~~blocks +```blocks bluetooth.startAccelerometerService(); -~~~~ +``` ### Video - Accelerometer service demo - Starts at 0:18 -[![micro:bit Bluetooth demo video](/static/bluetooth/microbit_accelerometer.png)]( - http://www.youtube.com/watch?v=aep_GVowKfs "Click to launch YouTube video" - ) +http://www.youtube.com/watch?v=aep_GVowKfs ### Advanced @@ -32,7 +35,8 @@ For more advanced information on the micro:bit Bluetooth accelerometer service i ### See also -[Bluetooth SIG](https://www.bluetooth.com) - -[Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +[Bluetooth SIG](https://www.bluetooth.com), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +```package +microbit-bluetooth +``` diff --git a/docs/reference/bluetooth/start-button-service.md b/docs/reference/bluetooth/start-button-service.md index 05e96c21..64c9b625 100755 --- a/docs/reference/bluetooth/start-button-service.md +++ b/docs/reference/bluetooth/start-button-service.md @@ -1,7 +1,12 @@ # Bluetooth Button Service +### ~hint ![](/static/bluetooth/Bluetooth_SIG.png) +For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first connect to the micro:bit. + +### ~ + 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 micro:bit is pressed. Each of the two micro:bit buttons can be in one of three possible states: * Not pressed @@ -12,23 +17,21 @@ The button service allows you to make other things which are connected to your m No additional code is needed on the micro:bit to use the Bluetooth button service from another device. -~~~~sig +```sig bluetooth.startButtonService(); -~~~~ +``` ### Example: Starting the Bluetooth button service The following code shows the Bluetooth button service being started: -~~~~blocks +```blocks bluetooth.startButtonService(); -~~~~ +``` ### Video - Button service demo - Starts at 0:59 -[![micro:bit Bluetooth demo video](/static/bluetooth/microbit_button.png)]( - http://www.youtube.com/watch?v=aep_GVowKfs "Click to launch YouTube video" - ) +http://www.youtube.com/watch?v=aep_GVowKfs ### Advanced @@ -36,7 +39,8 @@ For more advanced information on the micro:bit Bluetooth button service includin ### See also -[Bluetooth SIG](https://www.bluetooth.com) - -[Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +[Bluetooth SIG](https://www.bluetooth.com),[Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +```package +microbit-bluetooth +``` diff --git a/docs/reference/bluetooth/start-io-pin-service.md b/docs/reference/bluetooth/start-io-pin-service.md index 5d947a91..77d349e1 100755 --- a/docs/reference/bluetooth/start-io-pin-service.md +++ b/docs/reference/bluetooth/start-io-pin-service.md @@ -1,28 +1,31 @@ # Bluetooth IO Pin Service +### ~hint ![](/static/bluetooth/Bluetooth_SIG.png) +For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first connect to the micro:bit. + +### ~ + The Bluetooth IO pin service makes it possible for another device such as a smartphone to communicate with other electronic 'things' connected to a micro:bit's edge connector. You could for example, use your smartphone to switch on or off a light which is connected to the micro:bit or your smartphone could receive data collected from a sensor connected to the micro:bit. 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. No additional code is needed on the micro:bit to use the Bluetooth IO pin service from another device. -~~~~sig +```sig bluetooth.startIOPinService(); -~~~~ +``` ### Example: Starting the Bluetooth IO pin service The following code shows the Bluetooth IO pin service being started: -~~~~blocks +```blocks bluetooth.startIOPinService(); -~~~~ +``` ### Video - IO pin service demo starts at 3:49 -[![micro:bit Bluetooth demo video](/static/bluetooth/microbit_pin_io.png)]( - http://www.youtube.com/watch?v=aep_GVowKfs "Click to launch YouTube video" - ) +http://www.youtube.com/watch?v=aep_GVowKfs ### Advanced @@ -30,7 +33,8 @@ For more advanced information on the micro:bit Bluetooth IO pin service includin ### See also -[Bluetooth SIG](https://www.bluetooth.com) - -[Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +[Bluetooth SIG](https://www.bluetooth.com), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +```package +microbit-bluetooth +``` diff --git a/docs/reference/bluetooth/start-led-service.md b/docs/reference/bluetooth/start-led-service.md index 3f0a7c19..b05098fd 100755 --- a/docs/reference/bluetooth/start-led-service.md +++ b/docs/reference/bluetooth/start-led-service.md @@ -1,30 +1,33 @@ # Bluetooth LED Service +### ~hint ![](/static/bluetooth/Bluetooth_SIG.png) +For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first connect to the micro:bit. + +### ~ + The Bluetooth LED service allows another device such as a smartphone to send short text strings or patterns over a Bluetooth connection to a micro:bit for display on its LED matrix. Text will scroll across the micro:bit 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 micro:bit's LED matrix. So you could, for example, draw a smiley face in a smartphone app and at the press of a button, have it magically appear on your micro:bit on the other side of the room. Or you could program your smartphone to send a message to your micro:bit whenever your phone receives an email, SMS or social media message so you could wear your micro:bit like a smart watch and leave your phone in your bag. No additional code is needed on the micro:bit to use the Bluetooth LED service from another device. -~~~~sig +```sig bluetooth.startLEDService(); -~~~~ +``` ### Example: Starting the Bluetooth LED service The following code shows the Bluetooth LED service being started: -~~~~blocks +```blocks bluetooth.startLEDService(); -~~~~ +``` ### Video - LED service demo starts at 2:00 -[![micro:bit Bluetooth demo video](/static/bluetooth/microbit_led.png)]( - http://www.youtube.com/watch?v=aep_GVowKfs "Click to launch YouTube video" - ) +http://www.youtube.com/watch?v=aep_GVowKfs ### Advanced @@ -32,7 +35,8 @@ For more advanced information on the micro:bit Bluetooth LED service including i ### See also -[Bluetooth SIG](https://www.bluetooth.com) - -[Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +[Bluetooth SIG](https://www.bluetooth.com), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +```package +microbit-bluetooth +``` diff --git a/docs/reference/bluetooth/start-magnetometer-service.md b/docs/reference/bluetooth/start-magnetometer-service.md index 3208135f..8869a713 100755 --- a/docs/reference/bluetooth/start-magnetometer-service.md +++ b/docs/reference/bluetooth/start-magnetometer-service.md @@ -1,30 +1,33 @@ # Bluetooth Magnetometer Service +### ~hint ![](/static/bluetooth/Bluetooth_SIG.png) +For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first connect to the micro:bit. + +### ~ + The Bluetooth magnetometer service allows another device such as a smartphone to wirelessly receive data from the micro:bit'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 micro:bit is pointing relative to magnetic north. Using the Bluetooth magnetometer service you could, for example, create a smartphone application which displays your direction of travel, updating it in real time. No additional code is needed on the micro:bit to use the Bluetooth magnetometer service from another device. -~~~~sig +```sig bluetooth.startMagnetometerService(); -~~~~ +``` ### Example: Starting the Bluetooth magnetometer service The following code shows the Bluetooth magnetometer service being started: -~~~~blocks +```blocks bluetooth.startMagnetometerService(); -~~~~ +``` ### Video - Magnetometer service demo -[![micro:bit Bluetooth demo video](/static/bluetooth/microbit_magnetometer.png)]( - http://www.youtube.com/watch?v=C_0VL4Gp4_U "Click to launch YouTube video" - ) +http://www.youtube.com/watch?v=C_0VL4Gp4_U ### Advanced @@ -32,7 +35,9 @@ For more advanced information on the micro:bit Bluetooth magnetometer service in ### See also -[Bluetooth SIG](https://www.bluetooth.com) +[Bluetooth SIG](https://www.bluetooth.com), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) -[Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) +```package +microbit-bluetooth +``` diff --git a/docs/reference/bluetooth/start-temperature-service.md b/docs/reference/bluetooth/start-temperature-service.md index 298c9a63..4f695da6 100755 --- a/docs/reference/bluetooth/start-temperature-service.md +++ b/docs/reference/bluetooth/start-temperature-service.md @@ -1,30 +1,33 @@ # Bluetooth Temperature Service +### ~hint ![](/static/bluetooth/Bluetooth_SIG.png) +For another device like a smartphone to use any of the Bluetooth "services" which the micro:bit has, it must first connect to the micro:bit. + +### ~ + A micro:bit 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 micro:bit's current temperature reading or to receive a constant stream of temperature data values. Temperature values are expressed in degrees celsius. Using the Bluetooth temperature service you could turn your smartphone or tablet into a graphical thermometer using your micro:bit as the sensor. No additional code is needed on the micro:bit to use the Bluetooth temperature service from another device. -~~~~sig +```sig bluetooth.startTemperatureService(); -~~~~ +``` ### Example: Starting the Bluetooth temperature service The following code shows the Bluetooth temperature service being started: -~~~~blocks +```blocks bluetooth.startTemperatureService(); -~~~~ +``` ### Video - Temperature service demo - Starts at 3:05 -[![micro:bit Bluetooth demo video](/static/bluetooth/microbit_temperature.png)]( - http://www.youtube.com/watch?v=aep_GVowKfs "Click to launch YouTube video" - ) +http://www.youtube.com/watch?v=aep_GVowKfs ### Advanced @@ -32,7 +35,10 @@ For more advanced information on the micro:bit Bluetooth temperature service inc ### See also -[Bluetooth SIG](https://www.bluetooth.com) +[Bluetooth SIG](https://www.bluetooth.com), [Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) -[Bluetooth on micro:bit resources](http://bluetooth-mdw.blogspot.co.uk/p/bbc-microbit.html) + +```package +microbit-bluetooth +```