pxt-calliope/docs/reference/devices/on-notified.md

38 lines
1000 B
Markdown
Raw Normal View History

2016-08-10 22:10:40 +02:00
# On Signal Strength Changed
Register code to run when the signal strength of the paired device changes.
## ~hint
2017-03-28 00:43:37 +02:00
![](/static/bluetooth/Bluetooth_SIG.png)
2016-08-10 22:10:40 +02:00
2017-03-28 00:43:37 +02:00
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.
2016-08-10 22:10:40 +02:00
## ~
2016-08-10 22:10:40 +02:00
2017-03-28 00:43:37 +02:00
2016-08-10 22:10:40 +02:00
```sig
devices.onNotified(MesDeviceInfo.IncomingCall, () => {})
```
## Parameters
2016-08-10 22:10:40 +02:00
* ``body``: code to run when the signal strength changes.
## Examples
2016-08-10 22:10:40 +02:00
Display the signal strength on screen:
```blocks
devices.onNotified(MesDeviceInfo.IncomingCall, () => {
basic.showString("RING RING")
})
```
## See Also
2016-08-10 22:10:40 +02:00
[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength)
```package
devices
2016-08-10 22:10:40 +02:00
```