Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • Cybersecurity: Malformed Packet Attacks & Defenses

Cybersecurity: Malformed Packet Attacks & Defenses

Sender & Receiver Tests

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.   

 


Printer-friendly version
Malformed Packets and the Countdown Timer
Prev
Try This: Add Exception Handling
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress