Migrate docs from the other repo
This commit is contained in:
28
docs/reference/devices/on-gamepad-button.md
Normal file
28
docs/reference/devices/on-gamepad-button.md
Normal 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
|
||||
|
||||

|
||||
|
||||
### 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)
|
||||
|
40
docs/reference/devices/on-signal-strength-changed.md
Normal file
40
docs/reference/devices/on-signal-strength-changed.md
Normal 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
|
||||
|
||||

|
||||
|
||||
### 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)
|
||||
|
68
docs/reference/devices/raise-alert-to.md
Normal file
68
docs/reference/devices/raise-alert-to.md
Normal 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
|
||||
|
||||

|
||||
|
||||
### 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)
|
||||
|
42
docs/reference/devices/receive-number.md
Normal file
42
docs/reference/devices/receive-number.md
Normal 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
|
||||
|
||||

|
||||
|
||||
### 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)
|
||||
|
40
docs/reference/devices/signal-strength.md
Normal file
40
docs/reference/devices/signal-strength.md
Normal 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
|
||||
|
||||

|
||||
|
||||
### 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)
|
||||
|
80
docs/reference/devices/tell-camera-to.md
Normal file
80
docs/reference/devices/tell-camera-to.md
Normal 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
|
||||
|
||||

|
||||
|
||||
### 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)
|
||||
|
58
docs/reference/devices/tell-microphone-to.md
Normal file
58
docs/reference/devices/tell-microphone-to.md
Normal 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
|
||||
|
||||

|
||||
|
||||
### 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)
|
||||
|
92
docs/reference/devices/tell-remote-control-to.md
Normal file
92
docs/reference/devices/tell-remote-control-to.md
Normal 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
|
||||
|
||||

|
||||
|
||||
### 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)
|
||||
|
Reference in New Issue
Block a user