Micropython Visual Studio Code



Via Scott Hanselman’s blog:

  • Python visual-studio-code pylint micropython. Improve this question. Follow edited Apr 22 '19 at 11:48. Asked Jan 11 '19 at 11:07. Jos Verlinde Jos Verlinde. 485 2 2 silver badges 14 14 bronze badges. What if you added the stubs directory to PYTHONPATH of pylint process?
  • To be able to transfer your code to the EV3 Brick, you’ll first need to connect the EV3 Brick to your computer with the mini-USB cable and configure the connection with Visual Studio Code. To do so: Turn the EV3 Brick on. Connect the EV3 Brick to your computer with the mini-USB cable. Configure the USB connection as shown in Figure 12.

Follow the steps below to download, install, and configure this application: Download Visual Studio Code. Follow the on-screen instructions to install the application. Launch Visual Studio Code. Open the extensions tab. Install the EV3 MicroPython extension as shown in Figure 2. Figure 2 Installing the extension from the Visual Studio Code.

Visual studio code micropython esp8266

My son and I were working on an Adafruit NeoTrellis M4 Mainboard over the holidays. This amazing little device puts a NeoPixel + an Audio board + a USB port along with a 120 MHz Cortex M4 Core and a mic amplifier and you can program it with CircuitPython.

CircuitPython is open source and on Github at https://github.com/adafruit/circuitpython. “CircuitPython is an education friendly open source derivative of MicroPython.” It works with a bunch of boards including this NeoTrellis and it’s just lovely for teaching and learning.

Visual

There’s a great Python editor called Mu that works well with CircuitPython. However, my son and I are more familiar with Visual Studio Code so we wanted to see how it worked with CircuitPython.

We installed the Python extension for VS Code as well as the Arduino extension for VS Code and the Arduino IDE directly from the Windows Store….(now) we have a nice Developer Inner Loop going. That inner loop for us (the developers) is that we can write some code, hit save (Ctrl-S) and get immediate feedback. The application restarts when it detects the code.py file has changed and any debug (print) statements appear in the console immediately.

Micropython Visual Studio Code

We are really enjoying this Adafruit NeoTrellis M4 Express kit. Next we’re going to make a beat sequencer since the Christmas Soundboard was such a hit with mom!

I’m starting to really, really, like MicroPython. I particularly like the way that you can use the REPL command prompt to test out code before dropping it into your programs. I’ve been using an editor called Thonny which is nice enough but of course what I really want is to be able to use Visual Studio Code. It turns out that there’s a plugin for this. It’s called Pymakr. It lets you transfer Python files between your PC and your MicroPython device and provides a REPL prompt too. If you want to use it you have to install Node.js first. I did this and then found that it didn’t work. My MicroPython board was not detected.

I was using one of my Doit boards which usually works fine. (I’ve just bought another one….) It turns out that Pymakr maintains a list of USB devices that it is willing to connect with. You need to make sure that your device is on the list in the configuration file Pymakr.json. Use the command Pymakr>Global Setting to open this file and then add your device manufacture to the list, like I’ve done below.

Note that this is not the the manufacturer of your device, it is the manufacturer of the USB interface that the device uses to connect to the PC.

Circuit Python Vs Micropython

Micropython Visual Studio Code

You can find the name that you need by opening Device Manager, right-clicking the com port where your board is connected and then getting the manufacturer name from the properties page:

Visual Studio Code Micropython Ev3

I did this and everything started working. The Pymakr plugin has a nifty feature where it will copy all the Python files in your project into the device, or only copy the ones that you’ve changed. Very nifty.

If you’ve not played with MicroPython before I’ve written a tiny guide that you might find useful. You can find it here.





Comments are closed.