Let’s first make sure the sender and receiver micro:bit modules work as expected with normal packets. If the terminal doesn’t display what you type or display messages, try closing and reopening the terminal by clicking Close Serial and then clicking Open Serial again.
See Texting with Terminals if you need a reminder on how to set up the serial monitor and radio connections between the two micro:bit modules.
- Click the Show serial buttons in both python.microbit.org editors.
- In the serial monitor connected to the sender micro:bit, click to the right of the "Enter seconds to count down: " prompt.
- Type a number and press Enter.
- The program will then prompt you with Enter message after countdown:. Type the message you want it to display, then press Enter.
- Verify that the serial monitor connected to the receiver counts down to zero from the starting value you gave it, and then displays your custom message.
Now, it’s time to examine the effect a malformed packet can have on a script. At this point, the Sender serial terminal should be prompting you to enter another number of seconds to count down.
- In response to the Enter seconds to count down: prompt, type -1 and press Enter.
- In response to the Enter message after countdown: prompt, you can just press Enter again without typing any text.
- Verify that one of the lines displayed reads: “TypeError: can't convert 'int' object to str implicitly”.
- Try entering another number and message into the sender’s serial monitor. The receiver serial monitor should be unresponsive.
- You can manually restart the receiver micro:bit by pressing and releasing its reset button. It’s right next to the MicroUSB connector on the underside of the micro:bit. After that, the receiver will resume working as a countdown timer.
- Click Hide serial in both python.microbit.org editors.