When the micro:bit is flashed with MicroPython, it enables a simple file system to store files on device. Selecting the load button in the menu will bring up the files modal window.
- Navigate to https://python.microbit.org/v/beta
- Select Load/Save to open the files window
In addition to using MicroPython's built-in-modules, like
radio you can use the file system to include external python modules in your program.
You can drag and drop files or use the Add a file to the filesystem button to open the file dialogue.
A status bar shows you the file types you have uploaded and how much free space you still have available. The file size shown is the space it consumes inside of the micro:bit file system, not the MICROBIT drive as this is emulated storage. The status bar is colour coded to indicate file types.
The main.py file is your program, the python script from the text window. It is pre-set in the status bar and cannot be removed. If you try to upload another main.py file this will replace your code in the text window.
As you add files, they will appear in a list underneath the status bar. The list indicates the filename, the file type (eg. py is a python script), the size of the file and also a button with the option to Remove the file if you have added it in error.
Using external modules
Attached to this article is an example of module you can add to the editor and try out. The module includes a variety of emoji that represent the Images from microbit.Image
1. Add the attached emoji.py via the file system.
2. Open main.py in the editor and compile and download the .Hex file.
3. Try adding more emojis to emoji.py and show us your experiments!