I’m starting to really, really, like MicroPython. I particularly like the way that you can use the REPL command prompt to test out code before dropping it into your programs. I’ve been using an editor called Thonny which is nice enough but of course what I really want is to be able to use Visual Studio Code. It turns out that there’s a plugin for this. It’s called Pymakr. It lets you transfer Python files between your PC and your MicroPython device and provides a REPL prompt too. If you want to use it you have to install Node.js first. I did this and then found that it didn’t work. My MicroPython board was not detected.
If / when we can get pylance to work with the micropython stubs, this may become simpler as Pylance natively supports multi-root workspaces, meaning that you can open multiple folders in the same Visual Studio Code session and have Pylance functionality in each folder. 7.2 Minification. Live stream to showing how to load files and run code from your computer on a MicroPython board. Using a simple command line tool.
I was using one of my Doit boards which usually works fine. (I’ve just bought another one….) It turns out that Pymakr maintains a list of USB devices that it is willing to connect with. You need to make sure that your device is on the list in the configuration file Pymakr.json. Use the command Pymakr>Global Setting to open this file and then add your device manufacture to the list, like I’ve done below.
Note that this is not the the manufacturer of your device, it is the manufacturer of the USB interface that the device uses to connect to the PC.
Circuit Python Vs Micropython
You can find the name that you need by opening Device Manager, right-clicking the com port where your board is connected and then getting the manufacturer name from the properties page:
I did this and everything started working. The Pymakr plugin has a nifty feature where it will copy all the Python files in your project into the device, or only copy the ones that you’ve changed. Very nifty.
Micropython With Visual Studio Code
If you’ve not played with MicroPython before I’ve written a tiny guide that you might find useful. You can find it here.