uflash is a utility for flashing the BBC micro:bit with Python scripts and the MicroPython runtime. The BBC micro:bit board is the easiest alternative board to use with MicroPython. This is due to two software applications – a desktop application named Mu, and a command-line tool named uFlash. Mu is a full editor that you can use on your PC and, when connected to your BBC micro:bit via a USB cable, can save and execute the scripts. The uFlash tool can be used to manually transfer Python scripts to the board. Both options are available for use on Windows, macOS, and Linux.
The BBC micro:bit is a simple yet powerful computing device for beginner programmers. It is small, cheap, and easy to use. The British Broadcasting Corporation (BBC) created the device to promote digital creativity. In other words, the BBC wants to foster the skills and confidence needed for anyone to make cool stuff with computers!
The two modules that Mu uses to interact with the device are called uflash (for flashing the MicroPython runtime and code onto the device) and ufs (for interacting with the device’s filesystem). In both cases, you pronounce the “u” (µ) as “micro”, as in “microflash”. Both modules include code and command-line tools to interact with the device. Both are available as Python packages on PyPI, so if you have a relatively recent version of Python installed on your machine, use the pip command to install them in the usual way:
$ pip install uflash $ pip install microfs
If you encounter the below error:
uflash: command not found
you may try installing the below packager as per your choice of distribution.
Distribution | Command |
---|---|
Debian | apt-get install uflash |
Ubuntu | apt-get install uflash |
Kali Linux | apt-get install uflash |
Fedora | dnf install uflash |
Summary
If you use the uflash command without any arguments, it will attempt to find a connected micro:bit and flash an unmodified MicroPython runtime onto the device. To flash a Python script onto the device, simply pass the .py file as the first argument to the command:
$ uflash my_script.py