pxt-calliope/docs/reference/radio/received-signal-strength.md

56 lines
1.2 KiB
Markdown
Raw Normal View History

# received Signal Strength
2016-06-08 20:21:58 +02:00
Find how strong the radio signal is.
```sig
radio.receivedSignalStrength();
```
## ~ hint
**Deprecated**
This API has been deprecated! Use [received packet](/reference/radio/received-packet) instead.
## ~
Find how strong the ``radio`` signal is, from `-128` to `-42`.
(`-128` means a weak signal and `-42` means a strong one.)
2016-06-08 20:21:58 +02:00
2016-11-02 01:44:37 +01:00
The @boardname@ finds the signal strength by checking how strong it was
2016-06-08 20:21:58 +02:00
the last time it ran the
[on received number](/reference/radio/on-received-number) function. That means
2016-06-08 20:21:58 +02:00
it needs to run **receive number** first.
2016-07-18 23:04:15 +02:00
2016-06-08 20:21:58 +02:00
## Returns
* a [number](/types/number) between `-128` and `-42` that means
2016-06-08 20:21:58 +02:00
how strong the signal is.
## Simulator
2016-06-08 20:21:58 +02:00
2016-11-02 01:44:37 +01:00
This function only works on the @boardname@, not in browsers.
2016-06-08 20:21:58 +02:00
## Example
2016-06-08 20:21:58 +02:00
This example shows how strong the radio signal of the
2016-06-15 13:55:19 +02:00
[light level sender example](/reference/radio/send-number) is.
2016-06-08 20:21:58 +02:00
```blocks
let x = 0;
radio.setGroup(99);
basic.forever(() => {
x = radio.receiveNumber();
basic.showNumber(radio.receivedSignalStrength());
});
```
## See also
2016-06-08 20:21:58 +02:00
[on received number](/reference/radio/on-received-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
```package
radio
```