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
1.4 KiB
1.4 KiB
on Received String
Run part of a program when the @boardname@ receives a string over radio
.
radio.onReceivedString(function (receivedString) {})
Parameters
- receivedString: The string that was sent in this packet or the empty string if this packet did not contain a string. See send string and send value
~ hint
Watch this video to see how the radio hardware works on the @boardname@:
https://www.youtube.com/watch?v=Re3H2ISfQE8
~
Example
This program continuously sends a cheerful message. It also receives a messages from nearby @boardname@s. It shows these messages on the screen.
radio.setGroup(1)
basic.forever(() => {
radio.sendString("I'm happy");
})
radio.onReceivedString(function (receivedString) {
basic.showString(receivedString)
})
Troubleshooting
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.
See also
on received number, received packet, send number, send string, send value, set group
radio