LEGO Mindstorms EV3 officially supports Python (EV3MicroPython = Pybricks), and the extension function of VSCode (Visual Studio Code editor), which is Microsoft's free integrated development environment, and the firmware of EV3 have been released [^] 1].
It's easy to use just by adding an extension to VS Code, so it's recommended as an introduction to text programming using EV3, but there is one dissatisfaction with coding. That is, there is no auto-completion feature.
Here, we will introduce the procedure for auto-completion of EV3 Micropython API with VS Code.
As a prerequisite, Python3, Git % 81% 84% E5% A7% 8B% E3% 82% 81% E3% 82% 8B-Git% E3% 81% AE% E3% 82% A4% E3% 83% B3% E3% 82% B9% E3 % 83% 88% E3% 83% BC% E3% 83% AB) is installed on your PC, and as an extension of VS Code, Microsoft Python It is assumed that itemName = ms-python.python) and EV3 MicroPython are installed. (For MacOS, you also need to install XCode)
$ python -m pip install --upgrade pip
$ pip install git+https://github.com/pybricks/pybricks-api@master
The following is executed for each project (workspace). The setting is completed when a .venv file is generated for each project.
3. Select "New Project" from the EV3 MicroPython extension to launch a new project.
4. Launch the terminal (Crl + Shift + \ ) and run
python3 -m venv .ven v`.
When you restart VS Code, the pybricks API will be auto-completed. (The image shows method candidates displayed when left_motor, which is an instance of the Motor class, is described.)
Recommended Posts