VSCode Plugin User Guide
To facilitate developers using VSCode for QuecPython development, the QuecPython team has introduced a VSCode plugin called QuecPython
.
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
- Click on the
Extensions
icon in the primary sidebar . - Type
QuecPython
in the plugin search box. - Find the QuecPython plugin in the search list, click the
install
button to complete the plugin 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
Access the Firmware Flashing Interface on the Primary Sidebar
There are two methods:
Click on the QuecPython plugin icon on the primary sidebar .
Use the shortcut
Ctrl+Shift+P
to open the command palette, type> QuecPython
in it, and selectQuecPython: Focus on Firmware Manager View
from the options, as shown below:
The firmware flashing interface on the primary sidebar is shown in the following image:
Select Firmware
Click the
Select Firmware
button 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:
Flash Firmware
i. Click the
Flash
button on the firmware flashing interface.ii. In the pop-up confirmation window, click the
Yes
button .Now you can see the firmware flashing progress bar in the lower right corner of the VSCode interface:
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.
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 selectQuecPython: Connect to COM Port
from the options, as shown below:Connect to Terminal
Follow the instructions in the image below:
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 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:
Now, we have completed the simplest QuecPython REPL interaction.
Code Completion
Create a new Python script file
test.py
and open it in VSCode.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
orEnter
key to complete the code in thetest.py
file.
File Transfer
The edited script file test.py
needs to be imported into the module's file system to run.
- In the editor page of the file to be transferred (i.e.,
test.py
), right-click the mouse. - Click on the
QPY: Download File
command to start file transfer.
During the file transfer process, a pop-up window appears in the bottom right corner of the VSCode interface, as shown below:
File System Directory Tree
After the file transfer is complete, click on the
Explorer
button on the primary sidebar.Once the
Explorer
interface is open, look at the bottom and findQPY: 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:
Run Script File
- Select the script file
test.py
in the directory tree. - Right-click on the script file
test.py
and chooseRun Script
to execute the script file.
In the terminal window, you can see the script periodically outputting the string "Hello, QuecPython!"
.