2018-10-16 00:32:09 +02:00
|
|
|
# Received Packet Property
|
2018-07-09 20:17:32 +02:00
|
|
|
|
|
|
|
Get one of the properties from the last received radio packet.
|
|
|
|
|
|
|
|
```sig
|
2018-10-16 00:32:09 +02:00
|
|
|
radio.receivedPacket(RadioPacketProperty.SignalStrength)
|
2018-07-09 20:17:32 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
* **type**: the property type to get from the packet. These are:
|
|
|
|
>* ``signal strength``: the strength of the radio signal when the packet was received.
|
|
|
|
>* ``serial number``: the serial number of the board sending the packet.
|
|
|
|
>* ``time``: the time when the packet was sent.
|
|
|
|
|
|
|
|
## Returns
|
|
|
|
|
|
|
|
* a [number](/types/number) that is the property selected in the **type** parameter.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
This program uses the signal strength from received packets to graph the
|
|
|
|
approximate distance between two @boardname@s.
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.forever(() => {
|
|
|
|
radio.sendNumber(0)
|
|
|
|
})
|
|
|
|
radio.onReceivedNumber(function (receivedNumber) {
|
|
|
|
led.plotBarGraph(
|
2018-10-16 00:32:09 +02:00
|
|
|
Math.abs(radio.receivedPacket(RadioPacketProperty.SignalStrength) + 42),
|
2018-07-09 20:17:32 +02:00
|
|
|
128 - 42
|
|
|
|
)
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
|
|
|
## See also
|
|
|
|
|
|
|
|
[set transmit serial number](/reference/radio/set-transmit-serial-number)
|
2018-10-16 00:32:09 +02:00
|
|
|
|
|
|
|
```package
|
|
|
|
radio
|
|
|
|
```
|