pxt-calliope/docs/reference/radio/received-signal-strength.md
Juri Wolf 5f7a8e5301
Updates for V4 (#197)
* update yotta defaults for 16kb devices

* refactor deprecated blocks

* updates for button events

* update button events

* update refference

* update docs

* update docs

* update button event blocks

* update docs

* update block id
2022-08-10 09:36:19 -07:00

1.6 KiB

received Signal Strength

Find how strong the radio signal is.

radio.receivedSignalStrength();

~ hint

Deprecated

This API has been deprecated! Use received packet instead.

~

Find how strong the radio signal is, from -128 to -28. (-128 means a weak signal and -28 means a strong one.)

The @boardname@ finds the signal strength by checking how strong it was the last time it ran the on received number function. That means it needs to run receive number first.

Returns

  • a number between -128 and -28 that means how strong the signal is.

~ hint

Signal strength and board version

Measurement of the received signal strength is dependent on what version of @boardname@ you have. The @boardname@ boards prior to v2 can typically measure a signal strength up to -42 dBm. Now, v2 boards will measure a signal strength up to -28 dBm (typical).

~

Simulator

This function only works on the @boardname@, not in browsers.

Example

This example shows how strong the radio signal of the light level sender example is.

let x = 0;
radio.setGroup(99);
basic.forever(() => {
    x = radio.receiveNumber();
    basic.showNumber(radio.receivedSignalStrength());
});

See also

on received number, send number, on data received, received packet

radio