Hello World – micro:bit MicroPython with Mu
- A computer with the Mu editor, which you can download here: https://codewith.mu/
- A micro:bit
- A USB cable to link your micro:bit to the computer
- How to code in Python using the Mu editor
- How to check your code
- How to flash your code onto a micro:bit
- How to display text on a micro:bit
- How to display an image on a micro:bit
- How to comment your code
1. The Mu editor
You might see the last code that was created. To clear this, click on the New button.
Clears any code in the editor so that you can start a new program.
Flashes the program to the micro:bit.
Loads a program that you have previously saved.
Checks your code for errors.
Save the program to your computer.
2. Hello World using MicroPython
Before we flash this onto the micro:bit we need to save it. Click on the Save button and save to a folder on your computer or network. Name the file hello world. Once it’s save you’ll notice that Mu adds the correct file extension so it becomes hello world.py.
Note how the following code after the while is indented to the right. This is important as it shows which lines need to be repeated each time we go around the loop.