Migrate docs from the other repo

This commit is contained in:
Michal Moskal
2016-03-25 16:47:20 -07:00
parent 38d2cf06d2
commit a08eb53f92
895 changed files with 36888 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# On Gamepad Button
Register code to run when the micro:bit receives a command from the paired gamepad.
## Bluetooth required
The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart).
The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
### Block Editor
![](/static/mb/on-gamepad-button-0.png)
### KindScript
```
export function onGamepadButton(name: string, body:td.Action)
```
### Parameters
* ``body``: Action code to run when the the micro:bit receives a command from the paired gamepad.
### See Also
[tell remote control to](/microbit/reference/devices/tell-remote-control-to), [raise alert to](/microbit/reference/devices/raise-alert-to), [on notified](/microbit/reference/devices/on-notified), [signal strength](/microbit/reference/devices/signal-strength), [on signal strength changed](/microbit/reference/devices/on-signal-strength-changed)

View File

@ -0,0 +1,40 @@
# On Signal Strength Changed
The `on signal strength changed` function. #docs #devices #ble
Register code to run when the signal strength of the paired device changes.
## Bluetooth required
The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart).
The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
### Block Editor
![](/static/mb/on-signal-strength-changed-0.png)
### KindScript
```
export function onSignalStrengthChanged(body:td.Action)
```
### Parameters
* ``body``: code to run when the signal strength changes.
### Examples
Display the signal strength on screen:
```
devices.onSignalStrengthChanged(() => {
basic.showNumber(devices.signalStrength(), 150)
})
```
### See Also
[tell remote control to](/microbit/reference/devices/tell-remote-control-to), [raise alert to](/microbit/reference/devices/raise-alert-to), [on notified](/microbit/reference/devices/on-notified), [signal strength](/microbit/reference/devices/signal-strength)

View File

@ -0,0 +1,68 @@
# raise alert to
The raise alert to function. #docs #antenna #ble
Raise an alert on a remote device.
##
The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart).
The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
### KindScript
![](/static/mb/raise-alert-to-0.png)
### KindScript
```
export function raiseAlertTo(event: string)
```
### Parameters
* event - an event identifier
### Examples
To tell the connected device to display toast
```
devices.raiseAlertTo("display toast")
```
To tell the connected device to vibrate
```
devices.raiseAlertTo("vibrate")
```
To tell the connected device to play a sound
```
devices.raiseAlertTo("play sound")
```
To tell the connected device to play a ringtone
```
devices.raiseAlertTo("play ringtone")
```
To tell the connected device to find my phone
```
devices.raiseAlertTo("find my phone")
```
To tell the connected device to ring alarm
```
devices.raiseAlertTo("ring alarm")
```
### See also
[tell remote control to](/microbit/reference/devices/tell-remote-control-to), [tell camera to](/microbit/reference/devices/tell-camera-to), [on notified](/microbit/reference/devices/on-notified)

View File

@ -0,0 +1,42 @@
# Receive Number
The broadcast function. #docs #ble #radio
Reads the next radio packet as a number data packet.
## Important Security Consideration
The functions in the ``radio`` namespace allow the BBC micro:bit to communicate with other micro:bits.
This API does not contain any form of encryption, authentication or authorization. It's purpose is solely for use as a teaching aid to demonstrate how simple communications operates, and to provide a sandpit through which learning can take place.
For serious applications, BLE should be considered a substantially more secure alternative.
### Block Editor
![](/static/mb/receive-number-0.png)
### KindScript
```
export function receiveNumber() : number
```
### Returns
* packet - a number received.
### Examples
Broadcasts the value of ``acceleration`` x to other micro:bits.
```
radio.onDataReceived(() => {
led.plotBarGraph(radio.receiveNumber(), 1023)
})
```
### See also
[send number](/microbit/reference/radio/send-number), [receive number](/microbit/reference/radio/receive-number), [on data received](/microbit/reference/radio/on-data-received), [set group](/microbit/reference/radio/set-group)

View File

@ -0,0 +1,40 @@
# Signal Strength
The `signal strength` function. #docs #antenna #ble
Returns the signal strength reported by the paired device from ``0`` (no signal) to ``4`` (full strength).
## Bluetooth required
The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart).
The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
### Block Editor
![](/static/mb/signal-strength-0.png)
### KindScript
```
export function signalStrength() : number
```
### Returns
* the signal strength from ``0`` (no signal) to ``4`` (full strength).
### Examples
Display the signal strength on screen:
```
devices.onSignalStrengthChanged(() => {
basic.showNumber(devices.signalStrength(), 150)
})
```
### See Also
[tell remote control to](/microbit/reference/devices/tell-remote-control-to), [raise alert to](/microbit/reference/devices/raise-alert-to), [on notified](/microbit/reference/devices/on-notified), [on signal strength changed](/microbit/reference/devices/on-signal-strength-changed)

View File

@ -0,0 +1,80 @@
# tell camera to
The tell camera to function. #docs #antenna #ble
Access the photo/video-taking functionality of a remote device using the ``tell camera to`` function.
## Bluetooth required
The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart).
The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
### Block Editor
![](/static/mb/tell-camera-to-0.png)
### KindScript
```
export function tellCameraTo(event: string)
```
### Parameters
* event - an event identifier
### Examples
To tell the connected device to take a picture:
```
devices.tellCameraTo("take photo")
```
To tell the connected device to start recording a video
```
devices.tellCameraTo("start video capture")
```
To tell the connected device to stop recording a video
```
devices.tellCameraTo("stop video capture")
```
To tell the connected device to toggle front-rear
```
devices.tellCameraTo("toggle front-rear")
```
To tell the connected device to launch photo mode
```
devices.tellCameraTo("launch photo mode")
```
To tell the connected device to launch video mode
```
devices.tellCameraTo("launch video mode")
```
To tell the connected device to stop photo mode
```
devices.tellCameraTo("stop photo mode")
```
To tell the connected device to stop video mode
```
devices.tellCameraTo("stop video mode")
```
### See Also
[tell remote control to](/microbit/reference/devices/tell-remote-control-to), [raise alert to](/microbit/reference/devices/raise-alert-to), [on notified](/microbit/reference/devices/on-notified)

View File

@ -0,0 +1,58 @@
# tell microphone to
The tell microphone to function. #docs #antenna #ble
Access the audio recording capabilities of the device using the ``tell microphone to`` function.
The functions in the antenna namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart). The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
### Block Editor
![](/static/mb/tell-microphone-to-0.png)
### KindScript
```
export function tellMicrophoneTo(event: string)
```
### Parameters
* event - an event identifier
### Event values
* play
* stop
* pause
* forward
* rewind
* volume up
* volume down
* previous track
* next track
### Examples
To tell the connected device to start recording audio
```
antenna.tellMicrophoneTo("start capture")
```
To tell the connected device to stop recording audio
```
antenna.tellMicrophoneTo("stop capture")
```
### Other show functions
* use [tell remote control to](/microbit/reference/devices/tell-remote-control-to) to control presentation of media content
* use [tell camera to](/microbit/reference/devices/tell-camera-to) to control the photo/video recording of connected devices
* use [raise alert to](/microbit/reference/devices/raise-alert-to) to control the microphone of connected devices
### See also
[Antenna](/microbit/js/antenna)

View File

@ -0,0 +1,92 @@
# tell remote control to
The tell remote control to function. #docs #antenna #ble
Control the presentation of media content available on a remote device using the `tell remote control` to function.
##
The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart).
The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
### Block Editor
![](/static/mb/tell-remote-control-to-0.png)
### KindScript
```
export function tellRemoteControlTo(event: string)
```
### Parameters
* event - an event identifier
### Event values
* play
* stop
* pause
* forward
* rewind
* volume up
* volume down
* previous track
* next track
### Examples
To tell the connected device to start playing:
```
devices.tellRemoteControlTo("play")
```
To tell the connected device to stop playing
```
devices.tellRemoteControlTo("stop")
```
To tell the connected device to go to next track
```
devices.tellRemoteControlTo("next track")
```
To tell the connected device to go to previous track
```
devices.tellRemoteControlTo("previous track")
```
To tell the connected device to go forward
```
devices.tellRemoteControlTo("forward")
```
To tell the connected device to rewind
```
devices.tellRemoteControlTo("rewind")
```
To tell the connected device volume up
```
devices.tellRemoteControlTo("volume up")
```
To tell the connected device volume down
```
devices.tellRemoteControlTo("volume down")
```
### See also
[tell camera to](/microbit/reference/devices/tell-camera-to), [raise alert to](/microbit/reference/devices/raise-alert-to), [on notified](/microbit/reference/devices/on-notified)