Getting Started with the micro:bit — Remote Sensor Alarm

Someone has been stealing my sandwiches. We'll use the two-way radio communication on the micro:bit to catch the thief.

Favorited Favorite 0

Last time, we made a simple temperature gauge using the micro:bit and a servo. Now, we get a little more advanced as we examine two-way radio communication between micro:bits. The good news is that wireless communication is extremely simple using MakeCode.

To have two micro:bits talk to each other over the Bluetooth Low Energy (BLE) radio, you just need to assign a Group Number in code and then use the Radio Send String or Radio Send Value to transmit a message. The receiving micro:bit will call code under the On Radio Received block to do something with that message.

In the video, I first show how to create one program that gets uploaded to two different micro:bits. This simple app can be used to send the string "Yes" or "No" to the other micro:bit. In the second part of the episode, I show how to create a remote sensor that detects light before sending out a message on the BLE channel. The receiving micro:bit displays a static image and plays a simple tune on a tiny speaker whenever it receives that message.

Here is the messenger app. Upload it to two different micro:bits to try sending strings back and forth:

If you're interested in the remote alarm system, the AlarmSensor can be found here and the AlarmNotifier can be found here.

That concludes my "Getting Started with the micro:bit" series (at least for now). Hopefully, these tips and examples have helped you get an idea of how block programming can work with the micro:bit. What other things would you like to do or see done with the micro:bit? Please share your thoughts in the comments below.

Comments 3 comments

  • NorthernPike / about 7 years ago * / 1

    I got my micro:bit last week. Works like a champ. Temperature, direction, orientation, buttons, 5x5 LEDs, and even light sensing. Don't set brightness to 0 though. Use 1 for the minimum. A timing bug is getting fixed.

    I paired it with my Nexus 4 and also programed it with my Surface. I made a nice faceplate using my XYZ Jr. 3D printer.

    However, there is just one little itty bitty thing. I sort of felt like Alexander Graham Bell when his first phone didn't work. Of course not, I needed a second one to send and receive with. Should of bought two. Oh, well. If any of you out there remember the Sinclair ZX80, this is another cool contribution from the Brits.

    Also, you can get an edge connector here.

    • Glad you like it! Every now and then, I run into a problem with one randomly overheating, which seems odd (and could potentially be a bad early batch). However, they are slick little devices, and I love that there are so many ways you can program it.

      As for the edge connector, I grabbed a few a while ago, and I'm working on a little something that will hopefully make things easier. :)

Related Posts

It's Livestream Time!

Recent Posts

Why L-Band?


All Tags