Add modules to your micro:bit

In the Python language, you can use specialized instructions just for the micro:bit that are grouped into modules.  The cyberbot library archive includes several modules that will let you write micro:bit programs for your cyber:bot robot. You can read about them in the cyber:bot library reference here.

These files must be stored in a special area on your micro:bit module, called the file system.

  • Download the cyberbot library archive file:

cyberbot library archive

  • Extract the contents of the archive to a folder of your choice—you will access them from the code editor soon.

Install the modules

The process is slighty different depending on which software you are using.

Using online Python editor?

  • Click the Load button, and a file management dialog will appear.

  • From the folder where you extracted the cyberbot library contents, drag and drop the cyberbot.py file (and others, if desired) onto the gray Load Script or HEX file area of the dialog, or click the Add a file to the filesystem button.

  • Check that the cyberbot.py file (and any others you chose) now appear in the Manage files area.

  • Click the close button.

  • Add cyberbot import * near the top of your code in the editor area before you download or flash your project.

Now, cyberbot.py and any other added modules will be delivered to your micro:bit along with your code.

 

Using Mu editor?

  • From the folder where you extracted the cyberbot library contents, copy the contents into your computer's mu_code folder.
    • On Windows, the path is: C:\Users\<username>\mu_code
    • On Macintosh, the path is: Macintosh HD>Users>username>mu_code

  • Connect your micro:bit to your computer via USB cable.
  • Click on the Files button- a file management pane will appear at the bottom of the editor.

  • Drag and drop the cyberbot.py file (and others, if desired) from the right pane to the left pane.

Mu will transmit the file to your micro:bit.

  • Click on the Files button again to close the file management pane.
  • Add cyberbot import * near the top of your code in the editor area before you download or flash your project.

If you see a "no module named 'cyberbot'," error when flashing projects in the future, just follow these steps again the restore the micro:bit's cyberbot.py module