Add more desc to on-received-buffer (#1431)

This commit is contained in:
Galen Nickel 2018-10-16 10:20:05 -07:00 committed by Peli de Halleux
parent 1ecdb701f2
commit 920b30a304
3 changed files with 7 additions and 4 deletions

View File

@ -6,13 +6,15 @@ Run part of a program when the @boardname@ receives a buffer over ``radio``.
radio.onReceivedBuffer(function (receivedBuffer) {})
```
The data contained in **receivedBuffer** is put there as a data [type](/types). The data might be a [number](/types/number) or a [string](/types/string). When using buffers though, the way the data is placed in the buffer must have a specific format. In particular, numbers must have a certain order when their individual _bytes_ are placed into the buffer. The numbers must also be retrieved from the buffer using the order that they were placed in when set there. You can read more about [number formats](/types/buffer/number-format).
## Parameters
* **receivedBuffer**: The buffer that was sent in this packet or the empty string if this packet did not contain a string. See [send buffer](/reference/radio/send-buffer)
## Example: Remote level
If you load this program onto two @boardname@s, each board will send the level information to the other board.
Two @boardname@s work like remote levels. They lie flat and detect any change in the horizontal position of the plane that they sit in. Each board sends its level measurements to the other. Each level measurment is shown on the screen.
```typescript
let ax = 0;
@ -51,7 +53,8 @@ A radio that can both transmit and receive is called a _transceiver_.
## See also
[send buffer](/reference/radio/send-buffer)
[send buffer](/reference/radio/send-buffer),
[number formats](/types/buffer/number-format)
```package
radio

View File

@ -50,7 +50,7 @@ radio.onReceivedNumber(function (receivedNumber) {
The ``||radio:onReceivedNumber||`` event can only be created once, due to the hardware restrictions.
The radio set group might need to be set, synchronized , before the radio events will function.
The radio set group might need to be set, synchronized, before the radio events will function.
## See also

View File

@ -27,7 +27,7 @@ radio.onReceivedString(function (receivedString) {
The ``||radio:on received string||`` event can only be created once, due to the hardware restrictions.
The radio set group might need to be set, synchronized , before the radio events will function.
The radio set group might need to be set, synchronized, before the radio events will function.
## See also