Skip to content

Update radio-broadcast examples in reference pages#6122

Merged
abchatra merged 1 commit intomasterfrom
radio-send-msg-example
Mar 17, 2025
Merged

Update radio-broadcast examples in reference pages#6122
abchatra merged 1 commit intomasterfrom
radio-send-msg-example

Conversation

@ganicke
Copy link
Collaborator

@ganicke ganicke commented Mar 17, 2025

Update radio-broadcast examples in reference pages.

  • Add inherited pages for radio-broadcast from pxt-common-packages.
  • Update pages from ./libs/radio-broadcast even though they're obsolete.

Note: Despite using unique enums for the message names, the decompile and render into blocks on the document seems to always set it back to message1. The examples work fine in the editor context though.

enum RadioMessage {
    message1 = 49434,
    Hello = 49337,
    Goodbye = 16885
}
input.onButtonPressed(Button.A, function () {
    radio.sendMessage(RadioMessage.Hello)
})
radio.onReceivedMessage(RadioMessage.Hello, function () {
    basic.showIcon(IconNames.Heart)
})
input.onButtonPressed(Button.B, function () {
    radio.sendMessage(RadioMessage.Goodbye)
})
radio.onReceivedMessage(RadioMessage.Goodbye, function () {
    basic.showIcon(IconNames.Scissors)
})

Closes #6115

@ganicke ganicke requested review from Jaqster and abchatra March 17, 2025 18:34
@abchatra abchatra merged commit 41110f9 into master Mar 17, 2025
7 checks passed
@abchatra abchatra deleted the radio-send-msg-example branch March 17, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Radio Broadcast docs - sample code incorrect

2 participants