Anish Ansari
Published © LGPL

Communication of Micro:Bit Using Radio Signal

By the end of this article, you will know how to make two micro:bits communicate with each other.

BeginnerFull instructions provided30 minutes1,744

Things used in this project

Story

Read more

Code

Code for Radio Communications

JavaScript
radio.onDataPacketReceived(({ receivedNumber }) => {  
    if (receivedNumber == 1) {  
        radio.sendNumber(2)  
        basic.showIcon(IconNames.Heart)  
        music.beginMelody(music.builtInMelody(Melodies.PowerUp), MelodyOptions.Once)  
    }  
    if (receivedNumber == 2) {  
        music.beginMelody(music.builtInMelody(Melodies.PowerUp), MelodyOptions.Once)  
    }  
})  
basic.forever(() => {  
    if (input.buttonIsPressed(Button.A)) {  
        radio.sendNumber(1)  
        basic.pause(200)  
    }  
})   

Credits

Anish Ansari

Anish Ansari

11 projects • 25 followers
Azure and IoT

Comments