pxt-calliope/docs/reference/radio/send-string.md
2018-07-09 11:17:32 -07:00

875 B

send String

Sends a string to other @boardname@s in the area connected by radio. The maximum string length is 19 characters.

radio.sendString("Hello!")

Parameters

  • msg is a string to send by radio.

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.

input.onButtonPressed(Button.A, () => {
    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

radio