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.



Setup

  1. Navigate to https://python.microbit.org/v/beta
  2. Select load to open the files window

In addition to using MicroPython's built-in-modules, you can use the file system to include the external python modules in your program.


Testing

We need you to test that this feature works in a variety of environments; Operating systems, browsers. Use it as you would normally; try adding or removing python files and uploading and downloading .Hex files by

  • Drag and drop in the editor.
  • Selecting load and using drag drop in the file dropper.
  • Selecting load and using the file picker.
  • Continuing to test out the WebUSB feature in Chrome.


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


Test an example module

Attached 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!