Update on Visual Studio Code, new plugin

For anyone that is looking for an alternative to the Arduino IDE, there is now an Arduino plugin for Visual Studio Code, developed by Microsoft.

It is a much, much better IDE than Arduino, easily supports big projects, has very helpful code completion, etc. Here’s the link, though you can install it easily from within VS Code.

https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.vscode-arduino

You need to have the regular Arduino IDE installed, since it relies on many of the same libraries. I had it up and running in a matter of minutes. There is a handy little toolbar across the bottom of the screen that lets you define the board type, programmer, etc.

There are verify and upload buttons, just as in the Arduino IDE and they work the same. During upload you’ll see the Arduino splash screen.

A couple of small gotchas:

  1. You need to define a serial port, even if you are using the USBTinyISP and don’t need it. Any port will do.
  2. It will warn you about missing libraries. You might need to manually add #include <blinklib.h> to some sketches, and then define the include_path, VS Code will propose a fix.

Here’s the Arduino extension page in VS Code, you can install it directly from the extension marketplace.

Here’s an example, you can see how the Board Manager is supported, and you can select your board type.

Here’s BGA’s awesome Hexxagon, you can see how the programmer and the board type can be selected directly on the status line:

5 Likes

image

This looks much nicer than the Arduino IDE! The first gotcha is tripping me up. Whenever I click < Select Serial Port > or try to upload, I get the message to define a serial port, which just leads me back here. Can I get a clarification on how to define the serial port?

Click where Select Serial Port is written in the bottom blue bar? :slight_smile:

Returns the error displayed above

It doesn’t actually need the serial port when you are using the USB Tiny programmer, but it doesn’t let you proceed without one. Trying plugging in the serial interface board that came with the dev kit, that should turn up as a serial interface. Then select it, even though you won’t use it.

In my case I have a Bluetooth virtual serial port for some random robot selected.

I’ll report it as a bug, should be easy enough to fix. (Actually, it’s already on the issue tracker. The reporter found a workaround by editing the arduino.json file to include a dummy port.)

Actually, one can just manually edit the arduino.json file in the ,vscode dir and and do something like this:

{
    "board": "blinklib:avr:blink",
    "port": "dummy",
    "programmer": "USBtinyISP",
    "sketch": "blinks-hexxagon.ino",
    "output": "./output"
}

You just need to have a port listed there, even a dummy one. It is not used at all and it is just to make the VSCode Arduino extension happy.

2 Likes

Editing the JSON worked! I’ll try it again when actually using serial. Thanks @BGA and @gpvillamil