5. EXT: Mu editor

Mu editor is the simplest choice of windows apps to use when programming the microbit with micropython.
However, it can lag behind the latest version of micropython.
For some features it may be better to use the online simulator at https://python.microbit.org/v/3. This uses the latest micropython for the latest version of the microbit.

5.1. Installing at school

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

  2. Search for Mu.

  3. Install Mu editor.


5.2. First use

  1. Click the Mode icon and set the mode to BBC micro:bit.

  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.


5.3. Keyboard shortcuts

Useful keyboard shortcuts are at: https://codewith.mu/en/tutorials/1.1/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).


5.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


5.5. Mu editor Errors

Working out what has gone wrong and how to fix it is a key part of everyday programming.
Some errors will show up using the check button.
Some errors will not show up using the check button, but instead, will be scrolled on the microbit as an error message when the microbit is flashed. They contain the line number for where you should start to identify and fix the issue.

5.6. Downloads

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