Table of Contents
Additional Information Module 1
The latest version of Raspbian, the default operating system recommended for the Raspberry Pi, requires an 8GB (or larger) micro SD card. Not all SD cards are made equal, and some have higher failure rates than others. If you’re unsure, you can always buy our official SD cards from RS or Farnell. Any 8GB SD card will work, although you’ll need to follow the software setup guide https://www.raspberrypi.org/learning/software-guide to learn how to load an operating system onto the card.
Mu can be started in one of a number of modes; modes make working with Mu easier by only presenting the options most relevant to what you are planning to use Mu for.
When Mu first starts, you will be presented with the Select Mode screen.
Select the Python 3 mode and click OK.
Mu will remember what mode you select, so you only have to select it once. If you want to change the mode later:
Click on the Mode icon in the top-left corder of the screen.
Select the mode you want from the menu, and click OK.
Try out some Python projects using Mu:
Let’s try it out!
Copy and paste the following program into Mu. It is supposed to count down from 5 to 1.
print("count down") for count in range(5, 1, -1): print(count)
Now run it. You’ll see that it only counts down to 2:
count down 5 4 3 2
You can use Mu’s debugger to work out what is wrong.
Click the Debug button to start the debugger.
The debugger will start and the program will stop on the first line of code.
There are four buttons in the menu that allow you to control the debugger:
Continue: starts your program again, and it will then run until it hits a break point or finishes.
Step Over: runs the next line of code in your program
Step In: if the next line of code is a function, it will ‘step into’ the function and run it
Step Out: if the program is currently running a function, it will ‘step out’ of the function and return to the line of code that called the function.
There is also a Debug Inspector window on the right side of the code, showing the current value of any variables in use.
Click Step Over to run the first line of code.
The “count down” message will appear.
Click Step Over again to run the next line of code.
The count variable will appear in the Debug Inspector.
Keep clicking Step Over to run through each line in the program.
You will see that
count never reaches
1. This is because the
loop in the program does not reach
0. This is what the program should
print("count down") for count in range(5,0,-1): print(count)
Look and feel
Using the Zoom-in and Zoom-out buttons, you can change the size of the code.
Mu comes with a number of colour themes to suit different uses. Clicking the Theme button will cycle through the different themes.