Skip main navigation

£199.99 £139.99 for one year of Unlimited learning. Offer ends on 28 February 2023 at 23:59 (UTC). T&Cs apply

Find out more

Challenge 4: Coding the radio

Watch as Lorraine Underwood codes two micro:bits to send radio messages
Another feature of the micro:bit is that it can send radio
messages to other micro:bit that are within range. Let’s try that out.
If you want to send messages to another micro:bit, you have to be in the same group. Let’s have a look at the Radio menu, and we have radio set group one.
So when I start up my micro:bit, I’m going to set myself to group one.
That means I can send messages to other micro:bit who are also in group one, and I can receive messages from them. So let’s try this out.
So I’m going to send the number 11 to anybody who is in group one.
So let’s go back to the micro:bit homepage– MakeCode homepage– and create a new project.
For my second micro:bit, let’s join group one like before. But this time, we’re going to– when we receive numbers– remember, the first Microbit sent number 11 to us. We’re basically going to show that number.
So we’re going to say: here’s the number that has been sent to me.
It’s more difficult to do this in the simulator, but there is a way round. Let me show you a web page that you need to go to. We need to go to this new web address here, and that will give us two screens where we can code
multiple micro:bits at the same time. So I’m going to open up my two pieces of code that I’ve just created.
So once they’ve loaded, we can see the simulators down here in the bottom.
So when on this micro:bit on the right, when I press A,
it’s going to send a number to this micro:bit here on the left.
When this micro:bit receives the number, it’s just going to show it. So let’s try it out.
Let’s bring them up full screen. So when I press A, there we go– number 11.
OK, let’s try and make that a bit more obvious that something’s happening there. So I’m just going to create a variable. This is like our step program. And I’m going to change steps by 1 every time I press A. And then, I’m going to send the variable steps to the other
micro:bit. The step is going to start off at zero, and every time I press A, it’s going to increase. So let’s see– 1, 2, 3. So you can see that’s like the antenna, and it’s flashing every time it sends a signal.
So this micro:bit the code is not on here. All it’s doing is receiving, showing the information that
it’s receiving from this micro:bit.
So that’s one way we can use two micro:bits without actually having any hardware, just using the simulator.

The radio on the micro:bit is one of its most useful functions. Let’s learn how to use it.

This article is from the free online

Build a Physical Computing Prototype

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education