VSCode Plugin User Guide

To facilitate developers using VSCode for QuecPython development, the QuecPython team has introduced a VSCode plugin called QuecPython.

overview.png

The plugin currently supports the following features:

  • Firmware flashing
  • REPL command interaction
  • Code completion
  • File transfer
  • Filesystem directory tree
  • Run specific script files

It currently all QuecPython series modules.

Plugin Installation

  1. Click on the Extensions icon in the primary sidebar extensions-icon.png.
  2. Type QuecPython in the plugin search box.
  3. Find the QuecPython plugin in the search list, click the install button to complete the plugin installation.

installation

Plugin Usage Guide

Before you start, make sure you have downloaded the appropriate QuecPython firmware package for your module. Click here to view how to download firmware packages.

The following steps are demonstrated based on the U-235 development board.

Firmware Flashing

  1. Access the Firmware Flashing Interface on the Primary Sidebar

    There are two methods:

    • Click on the QuecPython plugin icon on the primary sidebar quecpython-plugin-icon.png.

    • Use the shortcut Ctrl+Shift+P to open the command palette, type > QuecPython in it, and select QuecPython: Focus on Firmware Manager View from the options, as shown below:

    cmd-palette.png

    The firmware flashing interface on the primary sidebar is shown in the following image:

    fw-flash-ui.png

  2. Select Firmware

    Click the Select Firmware button select-fw-button.png on the firmware flashing interface, and choose the firmware package for the U-235 development board module.

    The path to the firmware package will be displayed on the interface:

    selected-fw-path.png

  3. Flash Firmware

    i. Click the Flash button fw-flash.png on the firmware flashing interface.

    ii. In the pop-up confirmation window, click the Yes button flash-confirm-yes.png.

    flash-confirm.png

    Now you can see the firmware flashing progress bar in the lower right corner of the VSCode interface:

    flash-progress.png

    When the progress bar shows Flashing Firmware: 8/8 100%, the firmware flashing is complete, and the module will restart.

REPL Command Interaction

Before starting the REPL command interaction for QuecPython, it is necessary to flash the firmware that supports QuecPython functionality.

  1. Find the command to connect to the terminal in the command palette

    Use the shortcut Ctrl+Shift+P to open the command palette. Enter > QuecPython in the palette and select QuecPython: Connect to COM Port from the options, as shown below:

    connect-to-com-port-cmd.png

  2. Connect to Terminal

    Follow the instructions in the image below:

    connect-to-com-port-flow.gif

    Once the operation is completed, the module will be connected to the terminal in VSCode.

    At the same time, the terminal window will pop up with the content as shown in the image below:

    repl-terminal

  3. REPL Command Interaction

    After pressing Enter in the terminal, you will see the QuecPython command prompt >>>.

    Enter the following code in the terminal:

    print("Hello, QuecPython!")
    

    After pressing Enter, you can see the execution result as shown in the following image:

    repl-print-hello.png

    Now, we have completed the simplest QuecPython REPL interaction.

Code Completion

  1. Create a new Python script file test.py and open it in VSCode.

  2. In the editing page of the test.py file, enter the following code:**

    import utime
    
    for i in range(100):
        print("Hello, QuecPython!")
        utime.sleep(1)
    

    This code snippet is used to print the string "Hello, QuecPython!" in a loop every 1 second.

    As shown in the figure below, when entering the unique utime module of QuecPython, the VSCode interface will prompt for the methods it contains.

    Press the up or down arrow keys to move the cursor to the desired interface, and press the Tab or Enter key to complete the code in the test.py file.

    code-auto-completed.gif

File Transfer

The edited script file test.py needs to be imported into the module's file system to run.

  1. In the editor page of the file to be transferred (i.e., test.py), right-click the mouse.
  2. Click on the QPY: Download File command to start file transfer.

download-file.png

During the file transfer process, a pop-up window appears in the bottom right corner of the VSCode interface, as shown below:

downloading-file.png

File System Directory Tree

  1. After the file transfer is complete, click on the Explorer button explorer-icon.png on the primary sidebar.

  2. Once the Explorer interface is open, look at the bottom and find QPY: FILE SYSTEM (USR). It shows the directory tree of the module's file system /usr.

    The imported file test.py is shown in the following image:

directory-list.png

Run Script File

  1. Select the script file test.py in the directory tree.
  2. Right-click on the script file test.py and choose Run Script to execute the script file.

run-script.png

In the terminal window, you can see the script periodically outputting the string "Hello, QuecPython!".

test-script-running.png