Cybersecurity: Radio Data

What it’s about

In Cybersecurity: Radio Basics, micro:bit modules exchanged text messages.  There are other micro:bit radio applications where the transmitter and receiver need to exchange more than just text; they need to exchange data.  Some cyber:bot examples of data might include values like left and right robot wheel speeds with run times, or x and y accelerometer tilt values for tilt robot control.  

This tutorial shows how to make micro:bits exchange data.  The approach is similar to how apps and servers exchange data, with packets containing key-value pairs.  Thanks to MicroPython’s dictionary and string features, this easy and powerful technique takes just a couple lines of code.

Before you start

You will need:

  • Two or more micro:bit modules (on or off a cyber:bot)
  • Two USB A to MicroB cables
  • One or more computers with:
    • Access to python.microbit.org on a Chrome browser
      -- or --
    • Mu editor installed

Complete these tutorials first:

After you finish

You will be able to write MicroPython scripts that make micro:bit modules send and receive packet data containing key-value pairs.  Your scripts that receive messages will be able to access values based on their keys, copy them to variables, and use them to calculate, decide, repeat, and other familiar programming tasks to make your apps work.

After this, you will also be ready to move on to the next tutorial (coming soon!):