After a few weeks of MicroPython development using just command line tools and regular text editors it was finally time to once and for all figure out why I couldn’t get Visual Studio Code to behave on my Mac.

I had installed Visual Studio Code a while ago and found some nice extension that I could use for MicroPython. A nice set of extensions focussed specifically on Python is the Python Extension Pack.

The main thing is that I wanted to be able to quickly deploy code to an ESP32 based Dev Board, and there is a tool for that! I had experimented with PymaKr a few weeks ago but ran into some issues.

Pymakr enables you to communicate to specific Pycom board using the build in command line REPL, you can run a single file to your board, sync your entire project or directly type and execute commands. Although geared towards the Pycom boards some claimed it does work fine with other ESP32 based boards too. But, I just couldn’t figure out how to make it recognize my Heltec Wifi Kit 32 Dev Board.

After some tinkering today, I figured it out! First, you will have to find out what your specific USB port is that the Dev Board is connected to, you can do that with:

ls /dev/ | grep -i "tty" | grep -i "usb"

Once you have the correct setting you have to update the address settings accordingly in Visual Studio. To do so open Visual Studio, I will presume you have installed the PymaKr extension already, and click on “All commands” in the bottom toolbar (or what ever that bar is called) and select Global Settings. This will open the pymakr.json file and you can make the required edits.

After that you have to update the “auto_connect” setting to false or else It will not recognize the board. Here is the pymakr.json that makes things work for me.

{
	"address": "/dev/tty.usbserial-0001",
	"username": "",
	"password": "",
	"sync_folder": "",
	"open_on_start": true,
	"safe_boot_on_upload": false,
	"py_ignore": [
		"pymakr.conf",
		".vscode",
		".gitignore",
		".git",
		"project.pymakr",
		"env",
		"venv",
		"README.md",
                "Documentation",
                "/Documentation"
	],
	"fast_upload": false,
	"sync_file_types": "py,txt,log,json,xml,html,js,css,mpy",
	"ctrl_c_on_connect": false,
	"sync_all_file_types": false,
	"auto_connect": false,
	"autoconnect_comport_manufacturers": [
		"Pycom",
		"Pycom Ltd.",
		"FTDI",
		"Microsoft",
		"Microchip Technology, Inc."
	]
}

If you already have a project folder with an existing MicroPython project, you will want to update the address in the associated pymark.conf file in that project too. Mine looks something like this.

{
    "address": "/dev/tty.usbserial-0001",
    "username": "",
    "password": "",
    "sync_folder": "",
    "open_on_start": true,
    "safe_boot_on_upload": false,
    "py_ignore": [
        "pymakr.conf",
        ".vscode",
        ".gitignore",
        ".git",
        "project.pymakr",
        "env",
        "venv",
        "README.md",
        "Documentation",
        "/Documentation"
    ],
    "fast_upload": false
}

And to show you that it works! Here is a quick video!

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts