micro:bit ftp?

After creating an awesome project that has stored data in a file on the micro:bit your probably wondering how to retrieve this data.

You could sit down and devise some sort of interface to display the file contents line by line on the micro:bit display but you could also use the following package.

Introducing microfs

what?

Microfs is a tool that allows you to place and remove files onto a connected micro:bit with a syntax similar to ftp.

how?

  • Install the package
  • Flash an empty python project onto the micro:bit using mu
  • On the command line:
    • ufs ls list the contents on the micro:bit
    • ufs get <file> retreive file from micro:bit
    • ufs put <file> put a file onto the micro:bit
    • ufs rm <file> delete file on micro:bit

why?

With an empty project flashed onto it the micro:bit will sit there doing nothing.

If you were to use microfs to copy a main.py file onto the micro:bit and press the reset button then micropython will execute this file.

You can also copy over other python files and import them into main.py the same way as if you were importing modules for use.

Further reading

https://microbit-micropython.readthedocs.io/en/latest/tutorials/storage.html#file-transfer
https://microfs.readthedocs.io/en/latest/
http://www.multiwingspan.co.uk/micro.php?page=files