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
  • Breadboard Setup and Testing for micro:bit

Breadboard Setup and Testing for micro:bit

How it Works

Modules are files that typically contain Python functions, methods, and properties.  After your script imports a module, it can use the functions, methods and properties it contains.  For example, the continuity_tester script has this statement: from microbit import * which gives the script access to anything from the microbit module.  Without it, the script would not be able to call sleep(50).  The script also needs the microbit module for its display.show method and Image.YES property.  

# continuity_tester

from microbit import *
from multimeter import *
import music

while True:
    connected = continuity()
    if connected == True:
        display.show(Image.YES)
        #music.pitch(3000, 100)
    else:
        display.show(NC)

    sleep(50)

The continuity_tester script also uses a function named continuity.  That function is from a custom module called multimeter.  A custom module is different because the micro:bit module’s file system needs the multimeter.py file module before these statements can work properly: from multimeter import * and connected = continuity().  In this activity, the multimeter.py file was already added to continuity_tester.hex.  

See Add Modules to your micro:bit for an example of how custom modules are added to a .hex file.  In that example, the cyberbot module is used, but the steps of adding the multimeter.py module are similar.You can also download and view the multimeter.py by clicking these items in the python.microbit.org editor:

  • Load/Save button
  • Show Files dropdown
  • Download arrow by multimeter.py.  

To view its code, drag it into the python.microbit.org editor.  Keep in mind that this code is not a script and so cannot run on its own.  It has to be imported into your script, and then your script calls its functions.

Take a closer look at the while True: loop.  The multimeter module has a function named continuity(),  which returns True if it detects an electrical connection, or False if it does not.  In connected = continuity(), the variable connected stores the True/False result continuity returns.  When connected stores True , the statements in if connected == True makes the display show a checkmark with display.show(Image.YES).  Otherwise, statements in the else block display the not-connected circle with a slash with display.show(NC).  Note: NC is property of the multimeter module.

while True:
    connected = continuity()
    if connected == True:
        display.show(Image.YES)
        #music.pitch(3000, 100)
    else:
        display.show(NC)

    sleep(50)

 


Printer-friendly version
Try This – Probing the Board
Prev
Set Power for Circuits
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

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

© 2025 Parallax Learn • Built with GeneratePress