5f7a8e5301
* 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
51 lines
1.0 KiB
Markdown
51 lines
1.0 KiB
Markdown
# send String
|
|
|
|
Sends a string to other @boardname@s in the area connected by radio. The
|
|
maximum string length is 19 characters.
|
|
|
|
```sig
|
|
radio.sendString("hi!")
|
|
```
|
|
|
|
## Parameters
|
|
|
|
* **msg**: a [string](/types/string) to send by radio.
|
|
|
|
## ~ hint
|
|
|
|
Watch this video to see how the radio hardware works on the @boardname@:
|
|
|
|
https://www.youtube.com/watch?v=Re3H2ISfQE8
|
|
|
|
## ~
|
|
|
|
## Example: Two-way radio
|
|
|
|
If you load this program onto two or more @boardname@s, you can send a
|
|
code word from one of them to the others by pressing button `A`. The
|
|
other @boardname@s will receive the code word and then show it.
|
|
|
|
```blocks
|
|
radio.setGroup(1)
|
|
input.onButtonEvent(Button.A, input.buttonEventClick(), () => {
|
|
radio.sendString("Codeword: TRIMARAN")
|
|
basic.showString("SENT");
|
|
})
|
|
radio.onReceivedString(function (receivedString) {
|
|
basic.showString(receivedString);
|
|
})
|
|
```
|
|
|
|
## ~hint
|
|
|
|
A radio that can both transmit and receive is called a _transceiver_.
|
|
|
|
## ~
|
|
|
|
## See also
|
|
|
|
[on received string](/reference/radio/on-received-string)
|
|
|
|
```package
|
|
radio
|
|
``` |