1. About Mu Software

1.1. Install MU

Click to visit Mu software official website.

Mu is a Python code editor for beginner programmers, like teachers and students. We can get it by the official installer for Windows, Mac OSX or Linux (Mu no longer supports 32-bit Windows). The recommended version is Mu 1.2.0.

Step 1 - Make sure your OS so then download Mu Installer

First find out your computer operating system (Windows or Mac OSX). Open “This PC” to see “Properties”.

Img

Check the system type: 64-bit or 32-bit.

Img

Download MU. Download the version according to your computer operating system.

Img

Here we take the Windows system as an example, which can be a reference for Mac OSX and Linux.

Img

Step 2 - Run the installer

Double-click the installer (it is probably in your Downloads folder) to run it.

Img

We’ve outlined the extra steps needed to help Windows install Mu for Windows 10. Other versions will be similar.

Mu installer for MacOS.

Mu installer for Linux system.

For Windows 10, the Defender will pop up with a warning message. You should click on the “More info” link.

Img

The message will change giving you more information about the installer and display a “Run anyway” button. Click “Run anyway”.

Img

Step 3 - License Agreement

Review the license, select the check box and click “Install” .

Img

Step 4 - Installing

Go make a cup of coffee as Mu installs on your computer.

Img

Step 5 - Complete

The installation has completed successfully, click “Finish” to close the installer.

Img

Step 6 - Start Mu

You can start Mu by clicking on the icon in the Start menu or by typing “Mu” into the search box (both highlighted below). On first start, this may take some time.

Img

Here’s what it looks like:

Img

1.2. Using Modes & Menu Bar

Set “Mode” to BBC micro:bit .

On the menu, click “Mode” to set it to “BBC micro:bit”. The micro:bit mode understands how to interact with and connect to a micro:bit.

Img

Click to Start with Mu.

For more tutorials on using Mu, please visit: https://codewith.mu/en/tutorials/

1.3. Program on Mu

Here we load the “heartbeat.py” to Mu. Find it in the folder “Heart beat” we provided.

Img

Method one:

Open the Mu and click “Load” to choose the path where you downloaded the code.

Img

Img

Loaded successfully, as shown below:

Img

Method two:

Click “new” Imgto create a new program and drag “heartbeat.py” into it:

Img

Loaded successfully, as shown below:

Img

The same is true for adding other codes.

1.4. Download Code to Mciro:bit

Connect the board to computer via USB cable.

Img

Click “Flash” to download the code to the micro:bit board.

Img

After that, power on by the micro USB cable or external power supply (turn DIP switch to ON). You will see the on-board 5×5 LED matrix repeatedly shows Img and then Img.

Note that if there is an error in your code, it can also be able to download yet it will not work properly.

For example, the function sleep() is written as sleeps() in the code. Click “Flash” to load code to micro:bit. However, the 5×5 LED matrix shows messy icons.

Img

In this case, click “REPL” and press the reset button on the board on its back. The error message will be displayed in the REPL interface, as shown below:

Img

Img

Click “REPL” again to close REPL. And then click “Flash”.

To ensure that the code is correct, click “Check” after completing, and Mu will point out the error in the code.

Img

Modify the code according to the error message, and click “Check” again. Mu does not show an error.

Img

See more tutorials explaining specific aspects of Mu.

2. How Mu Import Library to Micro:bit

Before importing libraries, we need to upload a .py code (empty code is also ok) to the micro:bit board. Here we take an empty code as an example.

Connect the board to computer via USB cable. Open the Mu and click “Flash” to upload the .py code (empty code) to the board.

Img

In this tutorial, OLED and DHT11 modules are used. Therefore, the “oled_ssd1306.py” and “DHT11.py” library files need to be imported into the micro:bit board.

The default directory for Mu to save files is “mu_code”in the root directory of the user’s directory.

References link: https://codewith.mu/en/tutorials/1.0/files

Instructions for importing libraries:

1. Search for the “mu_code” folder on the Disk(C:).

Img

Img

2. Open “mu_code”.

Img

3. Copy and paste the library files “oled_ssd1306.py” and “DHT11.py” to “Libraries”.

Img

4. As shown below:

Img

5. Open the Mu and click “Files”. Here we drag “DHT11.py” library into micro:bit.

Img

Img

6. After importing “DHT11.py”, you’ll see it in the box on the left.

Img

7. Let’s do the same thing to the “oled_ssd1306.py”.

Img

Img

Note that when you upload other files to the micro:bit, they will overwrite the original content so you need to re-import it for the next time you use.