3. Mu editor

Mu editor is the simplest choice of windows apps to use when programming the microbit with micropython.


3.1. Installing at school

  1. Do a windows search for Software centre and open it.

  2. Search for Mu.

  3. Install Mu editor.


3.2. First use

  1. Click the Mode icon and set the mode to BBC microbit.

  2. Create a new file and save it in a folder called “DigiStem”.

  3. Create code for the microbit then click Check to check for any errors.

  4. To put code onto the microbit, connect it via USB then click the Flash icon.


3.3. Keyboard shortcuts

Useful keyboard shortcuts are at: https://codewith.mu/en/tutorials/1.2/shortcuts

Microbit

Keys

Action

F3

Flash code onto device (the same as clicking “Flash”).

Text Editing

Keys

Action

CTRL F

Show the find and replace dialog.

CTRL K

Toggle comments for the current or selected lines of code.

TAB

Indent the current or selected lines by four spaces.

SHIFT TAB

Unindent the current or selected lines by four spaces.

CTRL Z

Undo (keep pressing to keep undoing).

CTRL Y

Redo (keep pressing to keep redoing).

CTRL A

Select all

CTRL X

Cut selected text into the clipboard.

CTRL C

Copy selected text into the clipboard.

CTRL V

Paste text from the clipboard.

CTRL SHIFT S

Save the current tab with a new name (or double click the tab’s name).


3.4. Fixing indenting quickly

Select multiple lines of code.
Unindent them all at once using SHIFT TAB.
Indent them all at once using TAB
../_images/multi_line_indent_moving.gif

Questions

  1. What is the shortcut to toggle comments?

  2. What is the shortcut to increase the indent of selected lines?

  3. What is the shortcut to decrease the indent of selected lines?

  4. What is the shortcut to select all the text?

What is the shortcut to toggle comments? Ctrl: K

What is the shortcut to increase the indent of selected lines? TAB

What is the shortcut to decrease the indent of selected lines? SHIFT TAB

What is the shortcut to select all the text? Ctrl: A


3.5. Downloads

The latest version is at: https://codewith.mu/en/download


3.6. Uploading modules to the microbit

Place the module file in the mu_code folder: C:\Users\username\mu_code
The module file needs to be copied onto the microbit.
In Mu editor, with the microbit attached by USB, click the Files icon.
Files on the microbit are shown on the left.
Files in the mu_code folder are listed on the right.
Click and drag the module file from the right window to the left window to copy it to the microbit.
In the example shown, the module files is MOVEMotor.py.

Before copying:

../_images/Mu_files4.png

After copying:

../_images/Mu_files_copied4.png