Getting started with Radio Communications using the micro:bit

Micro:bits can easily communicate between each with bluetooth radio. In this project we will use one micro:bit as the data sender and another 8 micro:bits as receivers. Different types of information can be sent between the micro:bits and in this project we trigger an event when it receives a number.

Setting up the micro:bit to trigger the event

We will need to make sure that both the sending and receiving micro:bits can talk to each other so use the "radio set group" block to group 1 (you can change this if you want, just make sure you change it for all the receiving micro:bits)
Stacks Image 1043

Displaying the alphabet in a loop

The while / do loop below will display the character identified by the variable count from a string containing the alphabet. The 100ms pause gives you a chance to read the letter on the screen.

We are also using a variable called triggered to identify when the button has been pressed and to stop the loop.

Stacks Image 1053

Triggering the event

In this example I want to press the 'A' button on the first micro:bit to cause a chain of events in the rest of the.

On pressing the A button the variable triggered is set to true which stops the loop above. It also broadcasts the number 0 to all other micro:bits listening on radio group 1.

Stacks Image 1063

The complete code for the sending micro:bit

Our first micro:bit will need the main block of code below and the button triggering code above.

The complete code can be found here

Stacks Image 1105