0
votes

I'm using MicroPython extension, and have successfully flashed the MicroPython firmware (Operating System) to the ESP8266 target device using the NodeMCU flasher tool through a serial COM port.

After creating a new project by selecting the project folder I'm told auto detection of COM ports isn't available for Windows version of Visual Studio Code. I'm prompted to manually enter the COM port I've connected the target MicroPython device to, and VSC then says:

Port not exist, please connect device and try again!

I've tried all 4 USB ports, reinstalled the driver software, rebooted the computer, power cycled the target device and made sure the target device is in program flash mode (to allow application to be written to it) each time I attempt to connect VSC to it!

2

2 Answers

0
votes

I encountered the same problem as you in not being able to specify a port when using the Micropython IDE extension on windows.

I've found a simple way of running micropython scripts without leaving visual studio. First you'll need to install python, and then install ampy, using pip install ampy.

Then add this task.json build task. You'll need to adjust your baud rate and port as needed.

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "ampy",
            "type": "shell",
            "command": "ampy -b 115200 -p COM5 -d 1 run ${file} --no-output",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

Just type Ctrl+Shift+B to run the current python file on your device.

0
votes

I'd suggest using the pycom pymakr extension. pymakr connects via both serial USB as well as over TCP if your board/firmware can run telnet