ESP32 Micropython programming for VSCode. Features
RequirementsPythonIf you do not have it already installed install Python by downloading from the official site. You can use python 2.x but I'm recommend using 3.x will better. PipPip is a installer for python modules that both downloads and installs the modules, if you are not already installed pip, please click here. AmpyAmpy allows you to interact with the file system created on the chip. This module is required for this extension. You can install ampy by pip: rshellRemote Shell for MicroPython. This module is required for this extension. You can install rshell by pip3: That all! Just required rshell and Ampy! Extension SettingsThis extension has no settings for this release.You just press
Known IssuesThis extension has been tested on MacOS. If you have any trouble with your OS. Please contact me soon by open issue or via email address: dinophan94@gmail.com. All requests appropriate! Release NotesUsers appreciate release notes as you update your extension. 0.0.1First release |
If / when we can get pylance to work with the micropython stubs, this may become simpler as Pylance natively supports multi-root workspaces, meaning that you can open multiple folders in the same Visual Studio Code session and have Pylance functionality in each folder. 7.2 Minification. Download, install, and launch the free Visual Studio Code editor on your computer; Install and activate the LEGO Education EV3 extension; Connect the EV3 Brick to your computer and start to code; You will find a detailed description of the above steps in the EV3 MicroPython documentation PDF (link below). Visual-studio-code intellisense micropython. Improve this question. Follow asked Mar 18 '20 at 19:26. Patrick Patrick. 1,475 1 1 gold badge 15 15 silver badges 35 35 bronze badges. The answer is the correct how-to for this generic need. Install Pymakr plugin in Atom or VS Code and start with your IoT project in seconds. Write MicroPython code and up to three times faster compared to C/C. Send data to Pybytes IoT platform or use your device standalone with the range of supported networks. Start using our products here! Live stream to showing how to load files and run code from your computer on a MicroPython board. Using a simple command line tool.
This still isn’t working as I think it should. Especially the linting and autocomplete still doesn’t work (leaving only the PyMakr module which works partly, in fact). For example: “import pyb” still does not add autocompletion when typing something like “s = pyb.<CTRL + SPACE>”. Most likely this is because I used a combinations of tools that shouldn’t be used together. Need to spend more time on this…
I’ve recently started using a PyBoard for a project that I am working on. Writing code in an IDE, saving the files, then manually copying them to the board to test them gets tedious rather quickly. If you’re using Visual Studio Code, there are options to do almost everything from within the IDE itself. Getting things to work as they should took a bit of effort and headscratching. What I needed to do is documented below.
Links to the sources of my information is at the bottom.
- To prevent “Source directory /pyboard/stubs does not exist.” after creation open pybwrapper.py, change line 63 from
and save the file.
- Inside VSC, install the Pymakr plugin
- Install node.js (see link below, and reboot afterwards)
(This did not work properly for me. See below for another option.)
- Connect the PyBoard over USB
- Find out the serial port number (represented from here on by comXX)
- Run
(replace XX by com port number) -> this takes a couple of minutes
- the result will be copied to ~/.micropy/stubs (in my case in a sub directory “pyboard-1.13.0”
…Or get them from someone else
I got mine from Josverl on Github. See his read.me for more information as well.
- Pick a directory that will hold the files. Clone the repo:
create a symlink in your project folder:
- create a settings.json file in your project folder containing (change the references to the stubs you need, in the desired order):
- Copy the .pylintrc file from the sample folder and adapt the init-hook line to reflect the chosen folders (in last step):
- Restart VSC:
- To check that your stub (config file for your board) has been installed run
- If not, run
(where the path is the directory that contains the info.json file.)
- run
- Select what to generate (‘a’ selects all)
- select which stub to use (the one you just created)
- A subdirectory will created with <project name> you just specified
- Open the pymakr.conf file in the subdirectory <project name>. Change
to your comXX. To do this system wide for Pymakr, open the command palette (CTRL+SHIFT+P) and select/type “Pymakr > Global settings”
- In the same config file, I had to set “auto_connect”: false to resolve some vague
errors when connecting to the board. Setting this to “true” the following behavior: “ignores any ‘address’ setting and automatically connects to the top item in the serial port list”
- See here for more explanation on the other options
- To add package dependencies to your project:
- Functionality in the Pymakr addon can be used by opening the command palette (CTRL+SHIFT+P) and typing Pymakr. There are options to (dis)connect, run the current file, up/download the whole project, get the FW version,…
- Note the new terminal “Pymakr Console”:
- And the “Pymakr toolbar”:
- Lemariva #MicroPython: VSCode IntelliSense, Autocompletion & Linting capabilities
Most information on setting up came from here, but I had some issues along the way (mostly because the PyBoard wasn’t installed by default and the default method of adding a stub wasn’t working, see below)
Visual Studio Code Micropython Esp8266
- Micropython-stubber from Josverl on Github
For creating the stub for your board
- Cannot create stubs on WiPy issue
One of the issues I encountered and the “solution”
- Pymakr addon for VSC
For the communication with the board
- Lemariva #MicroPython: Visual Studio Code (VSCode) as IDE
For more information on how to connect to the board and use the IDE
Circuit Python Vs Micropython
- Node.js installer
Node.js installer. Reboot after installation. - BradenM micropy-stubs
A number of stubs, not including the PyBoards unfortunately - dastultz pyboard stub
Haven’t gotten this to work yet - Great info from Josverl on Github
Became my primary resource for the stubs and how to use them