 Have you been trying to get your microbits to communicate with each other via radio? Come in, yellow microbit. Hello, this is yellow microbit. I can hear you loud and clear, green microbit. Over. We'll stick around because in this tutorial I'm going to show you how to use radio on microbit through the Microsoft MakeCode editor. And we'll get these two sending and receiving messages to each other in no time. In just a moment. Hello world, it's The Surfing Scratcher here, teacher, surfer, programmer and lover of learning bringing you the goodness of coding through games. On this channel, we code projects together using video tutorials. So if you're new here, consider subscribing. Be sure to check out the show notes and links in the description below where I list out a bunch of resources and unplugged activities that can help you along on your learning journey. Alright, let's get stuck into it. This tutorial is more of our hands on how to with microbit radio. If you want a more of a technical explanation, I've got a card linked above to a great tutorial from the MakeCode website. Alright, the first thing we need to do is delete this forever block. We don't need it. See you later. We need to do everything in our on start at the moment. The first thing that we need to do is head on over to our radio category here because we're working with the radio. And have you ever heard the expression being on the same wavelength? Well, our microbits need to be on the same wavelength, which means the same group. I'm going to check that number to 77 because that is a gnarly number. So now our microbits will all be on the same channel and they can communicate to one another. The next thing that we need to do is set up something to send to another microbit. So how are we going to do that? Well, we need some input. We need to do something on a button press. So when the A button is pressed, we want to do some business. So here I am pressing the A button, nothing happened. Let's go hook that up. So let's go back into our radio category and we said that we're going to send some stuff. So let's look at these three blocks here. We can send a number, broadcast a number over radio to any connected microbit in the group. We can broadcast a name value pair along with the device serial number and running time to any connected microbit in the group. And we can also broadcast a string along with the device serial number. So we're going to go ahead and broadcast a string. Now a string is just another word for text. Now the students in my class have asked that they can send poop emojis to each other. So that's exactly what we're going to go ahead and do. What I like to do with my projects is yes, we've got text here but I actually like to turn this into a variable. We've just got text as it is just there. It's prone to typos and spelling errors. So if we create a variable of the same name, poop emoji then we're not going to have any problems. So on start, we're going to set that poop emoji not to zero. We're going to go down here and grab some fancy quote marks slot that in. Let's go get our poop emoji text, our poop emoji string and place that in our poop emoji variable. What we're going to do now is send that poop emoji variable. And of course that value is equal to poop emoji that may well have confused you. I'll show an example of why that works in just a moment. So now we're sending our poop emoji string but nothing's happening. We need to now receive it. Let's jump back into our radio. And this time we're going to check out all the blocks that we can use to receive a message. So we can receive the number. We can receive that pair or we can receive that string. So let's receive that string and let's just check it out. So let's just show that string. We go into our variables, show received string and let's do it. Poop emoji. All right. That's cool. That says poop emoji text but that's not poop emoji as in a graphic of the poop emoji. So let's go ahead and change that now. So let's get rid of a show string. Let's get some LEDs. Let's create a poop emoji. Be very interested to see if you can create a poop emoji that looks a little bit better than mine. I've got some poop here, a pile of poop with a little bit of stink coming off the top of it. Let's go ahead and check out how we're going here. One click to slide in our next marker bit and the next click to display our poop emoji. Boo-ha. All right. So this currently works for any string that's being placed in here. So let's talk about that typo that I was talking about before. So if I were to go ahead and type pop emoji instead of poop emoji and then we go ahead and do the same thing, it comes up anyway. So that's not what we want. We want it only to show that poop emoji when we receive poop emoji. So to do that we need to be a bit more specific in our handling of this receive string here. We need some logic. We need to get an if statement and in that if statement we want to check if that receive string is equal to poop emoji. So we need to comparison. Let's go into our variables. If that receive string is equal to our poop emoji, then let's show that poop emoji. Let's run it and there we go. So if we get our typo back in place here, I'll just drag out our variable. This now should not work and it doesn't. But if we place our poop emoji back in there and we click our buttons, our A button that is working as you would expect. All right. Let's use our other couple of buttons just to pad this out a little bit more. So let's go ahead and get some more input. This one is going to be on a B press and we'll just duplicate that and let's get an A and B press. I recommend on an A and B press, let's just clear it, clear the LEDs. Go back to nothing. And I'm feeling a little bit animaty. So what we're going to do is we're going to duplicate our radio send string for B and instead of sending out poop emoji, let's create a new variable and let's animate poop emoji this time. Give it some nice stinky bits. Okay. We're going to duplicate our poop emoji or animate poop emoji and animate poop emoji. Okay. You can see that over there. Animate poop emoji. Cool. We no longer want to send poop emoji in the B press. We want to send animate poop emoji. Cool. Everything is working as it should right now. So if we go ahead and press A, here it has come up in the screen. If we press A and B, it clears that poop emoji. Next thing that we're working on now is pressing this B button and now we want to animate that emoji. To do that, we can just grab this whole block here and duplicate it, connect it. Let's change our poop emoji to the animate poop emoji and now we're going to create a basic animation. So to do that, we're going to go get a short pause connected to the bottom. Let's duplicate that LED screen there and let's change it up a little bit. Cool. Might even add a little bit of stink to the top of it. Let's get one more pause and let's wrap this whole thing in a loop. Let's do it. I reckon three times because three is a great number. All right. So let's go ahead and press our B button now. All right. Got our blue micro bit up on the screen and look there is our stinky pile of poop animating away. All right. So when you go ahead now and download your hex files to both of your micro bits and you can send poop emojis to each other until your heart's content. All right. Let's press the A button to send across that poop emoji and then we'll double finger press to clear the screen and then let's press the B button to send an animated emoji across the other micro bit. All right. It's time for a Cody question. I want to know how you want to use the radio function of the micro bits. Drop your answer in the comment section below or maybe even share a URL to your make code project. That'd be unreal. Hey, thanks for checking out this tutorial. Subscribe, like and ring the bell if you're new around here and be sure to have a scout of some of my other content which is on the screen right now. If you can't get enough then head on over to my Patreon page where you can join a membership tier for access to exclusive content. Link in the description below. But until then, I'm off to go find a wave. I'll catch you in the next one.