pxt-calliope/docs/reference/devices/tell-remote-control-to.md

91 lines
1.6 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# tell remote control to
Control the presentation of media content available on a remote device using the `tell remote control` to function.
2016-06-21 07:06:19 +02:00
### ~hint
2016-03-26 00:47:20 +01:00
2016-06-21 07:06:19 +02:00
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).
2016-03-26 00:47:20 +01:00
The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device.
2016-06-21 07:06:19 +02:00
### ~
2016-03-26 00:47:20 +01:00
2016-06-21 07:06:19 +02:00
```sig
devices.tellRemoteControlTo(event: string)
2016-03-26 00:47:20 +01:00
```
### 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:
2016-06-21 07:06:19 +02:00
```blocks
2016-03-26 00:47:20 +01:00
devices.tellRemoteControlTo("play")
```
To tell the connected device to stop playing
2016-06-21 07:06:19 +02:00
```blocks
2016-03-26 00:47:20 +01:00
devices.tellRemoteControlTo("stop")
```
To tell the connected device to go to next track
2016-06-21 07:06:19 +02:00
```blocks
2016-03-26 00:47:20 +01:00
devices.tellRemoteControlTo("next track")
```
To tell the connected device to go to previous track
2016-06-21 07:06:19 +02:00
```blocks
2016-03-26 00:47:20 +01:00
devices.tellRemoteControlTo("previous track")
```
To tell the connected device to go forward
2016-06-21 07:06:19 +02:00
```blocks
2016-03-26 00:47:20 +01:00
devices.tellRemoteControlTo("forward")
```
To tell the connected device to rewind
2016-06-21 07:06:19 +02:00
```blocks
2016-03-26 00:47:20 +01:00
devices.tellRemoteControlTo("rewind")
```
To tell the connected device volume up
2016-06-21 07:06:19 +02:00
```blocks
2016-03-26 00:47:20 +01:00
devices.tellRemoteControlTo("volume up")
```
To tell the connected device volume down
2016-06-21 07:06:19 +02:00
```blocks
2016-03-26 00:47:20 +01:00
devices.tellRemoteControlTo("volume down")
```
### See also
2016-06-19 14:28:46 +02:00
[tell camera to](/reference/devices/tell-camera-to), [raise alert to](/reference/devices/raise-alert-to)
2016-03-26 00:47:20 +01:00
2016-06-21 07:06:19 +02:00
```package
microbit-devices
```