In addition, to drag and drop download,  Chrome based browsers (Android, Chrome OS, Linux, macOS and Windows) support direct flashing from the browser to the device over USB.  This enables you to flash your micro:bit straight from the browser without the need to save the .hex file first, and use serial communication between the micro:bit and the editor. 


Requirements

To use direct flashing from the browser, you'll need to have:


Direct flash in MakeCode

  1. Select the more options (three dots) menu next to the Download button and then choose Pair Device
  2. A browser pop-up will let you select your BBC micro:bit and then click Connect. You will see the USB symbol flashing on the Download button to indicate a successful connection.
  3. Select Download to instantly flash your program to the micro:bit. The first time you do this it may take a bit longer, but subsequent flashes will be faster.




Direct flash in the Python Editor

  1. Choose Connect from the menu. A browser pop-up will let you select your BBC micro:bit and then click Connect. Once the device is paired, the Download button becomes Flash.
  2. Select Flash to instantly flash your program to the micro:bit. The first time you do this it may take a bit longer, but subsequent flashes will be faster.

Using the REPL in the Python Editor

We have also introduced a REPL (Read-Eval-Print-Loop) shell function in the editor.

  1. With a micro:bit that has been connected over USB and flashed with a Python program, select the Open Serial button. Click the banner or press CTRL-C to enter the REPL.

  2. You can now communicate with the micro:bit as if you have a serial connection.

Note that you must reload the browser after using the REPL before flashing with webUSB.


Due to a technical limitation in the software you may experience data loss if you are sending data over serial at a high rate.


Direct flash in MakeCode on Android with a USB OTG cable

For this to work you will need to use a USB On-the-Go cable



  1. Plug in your cable and open https://makecode.microbit.org#editor.
  2. Select the more options (three dots) menu next to the Download button and then choose Pair Device
  3. A browser pop-up will let you select your BBC micro:bit and then click Connect. You will see the USB symbol flashing on the Download button to indicate a successful connection. You may get an additional notification asking if you want to allow your Android device to communicate with the micro:bit.
  4. Select Download to instantly flash your program to the micro:bit. The first time you do this it may take a bit longer, but subsequent flashes will be faster.



Troubleshooting

Direct flashing is still in development and as such you may experience issues in using it. Here is some troubleshooting advice for using webUSB with the micro:bit and the editors.