Daily tips and tricks from the experts at Adafruit!
View this email in your browser

Last week the first version of a BBC micro:bit MicroPython plugin for the PyCharm Python IDE was released!  This plugin allows you to program MicroPython code to a connected micro:bit, and view the output from the micro:bit’s REPL in a tab of the editor.  You can find the plugin code here on GitHub and basic instructions for how to load it with the PyCharm or IntelliJ IDEs.

I tried out the plugin myself and found it even works great on the free PyCharm community edition editor that you can download at no cost.  There’s not much documentation on how to use it yet so here are a few tips:

  • To install the plugin with PyCharm community edition go to Preferences -> Plugins and click the Install JetBrains Plugin button.  Then search for MicroPython and install the MicroPython Support plugin (shown above).  You might need to restart the editor after installing the plugin.
  • Once installed create a new Python project.  The Python version or interpreter you pick doesn’t seem to matter (remember it’s MicroPython on the micro:bit that will be running your code, not Python on your computer).  However to use the MicroPython features you must enable them for the project by going to Preferences -> Languages & Frameworks -> MicroPython and checking the Enable MicroPython box.
  • Once MicroPython is enabled for your project you can flash code to a BBC micro:bit by connecting it to your computer and clicking the Run -> Run… command and then selecting Flash xxxx.py to device… in the context menu that appears.  Right now only BBC micro:bit devices appear to be supported.
  • To view the board REPL run the Tools -> MicroPython REPL command and a new tab with the REPL of the connected micro:bit will be displayed.

This looks like a great start for MicroPython support in the PyCharm editor.  From the description on GitHub more MicroPython boards will likely be supported in the future too!