Version 2

The October 2019 release of the micro:bit Python Editor (python.microbit.org) brought with it a number of new features and UI changes. This release is version 2 of the editor.


Previous programs still work

You are still be able to import .Hex files and Python scripts created in the previous version of the editor and use them in the latest version. Load them into the editor by drag-and-drop, or using the file picker and simply download them again to ensure they are up to date. The underlying version of MicroPython in the v2 editor has not changed from the current live editor, so all programs will continue to work in the same way.


Access the old editor

Should you need to, you can always access the previous version of the editor at python.microbit.org/v/1 which will be available for the next two years. 


The Menu


The updated menu consolidates the Load/Save buttons into one place that also provides access to the new File System. You will also see options to connect and interact with your micro:bit via the serial interface. These are enabled if you’re using a browser that supports WebUSB, like Google Chrome and you have a recent version of the firmware on your micro:bit.  If you are using a browser that doesn’t support WebUSB, a message will tell you that these features are unavailable.


The File System

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 and you are able to inspect the files on your micro:bit. Initially this will just be your program script main.py, but you can also add modules here too that can be called form your program. See our article on beta testing files and modules for more information.


WebUSB

When using a browser that supports WebUSB, like Google Chrome or the latest Edge Beta,  the options for connecting to and interacting with your micro:bit in the browser will be enabled.


The Connect button allows you to connect to your micro:bit via webUSB. When you choose to connect, a window will pop up in your browser asking you to choose the micro:bit, you want to connect to.


If you see the message 'no compatible devices found', you may need to update the micro:bit firmware. When you are connected you will see this menu item change to 'Disconnect'.


The Open/Close Serial button allows you to dynamically interact with MicroPython on the micro:bit once you have entered the REPL. You will need to flash the micro:bit with a MicroPython hex in order to use the REPL.


The Read, Evaluate, Print Loop(REPL) is a way of dynamically interacting with the micro:bit using MicroPython. To interact with the REPL on the micro:bit, when youOpen Serial you will be asked to ‘Click here or press CTRL-C to enter the REPL’. Once you have done so, try typing something in MicroPython. eg 

                

 

>>> help()


>>> from microbit import *


>>> display.scroll("Hello from the REPL")


>>> import this


>>> import love


>>> import antigravity



Translations

From this menu you have the option to select a language for the editor. The functionality here is demonstrating the capability to load translations and as yet there are only basic examples in place. There is a link to Add a language that provides more information on translating the Python Editor.