Go Down

Topic: Building with Visual Studio Code (on OSX) (Read 500 times) previous topic - next topic

davepl

Sep 27, 2018, 04:57 pm Last Edit: Sep 27, 2018, 04:58 pm by davepl
I don't think the OSX part matters, but I've got Visual Studio Code working, I have the Arduino extensions for it, and I have my .ino workspace loaded.

When I try to build, however, I get "Configure Build Task".  I can't get past that.  I can create a json build task file and so on but ... I'm stuck.  Please tell me the simple baby steps needed, not big things like "Configure the json script that controls the build process", I need to know how to do that.

Most of the tutorials stop with installing the Arduino extensions, which was the easy part.  If someone could tell me the steps or point me at an article on how to :

COMPILE
BUILD
RUN

Those are the three steps that have me totally stymied.  I would appreciate any actionable help (as opposed to the 'it was hard for me it should be hard for you' approach)!

How do I get from "Configure Build Task" to running project?

davepl

Hmm... am I the only person that's tried?  It -looks- like a really nice environment if I can get it working!

davetcc

#2
Sep 30, 2018, 11:56 pm Last Edit: Oct 01, 2018, 01:38 pm by davetcc
Hi I've been using the Microsoft Arduino plugin for VsCode on Mac.

It's gaining ground quickly from what I can see, but documentation is a bit fragmented.

All the Arduino functions are on the command palette which is accessed using CMD-SHIFT-P. Start typing Arduino and you'll see them all there.
 
When loading a sketch into VsCode for the first time, choose "Arduino - initialize" from the command palette. This sets up the .vscode directory for both c++ and arduino. You'll see JSON config in there. Mostly self explanatory. This also sets up the board type and port etc.

To build onto the device after doing initialise, you'll see there are two other entries on the palette, verify and upload along with a serial monitor. Note that the verify/upload uses the standard Arduino toolchain directly, so if it will compile in the regular IDE, it will compile here, regardless of what the intellisense says.

Also, for language completion on custom libraries, you use have to add them to the includes section in the cpp config file. Open '.vscode/c_cpp_properties.json' and you'll see the includePath section.

It's still early days for this tool at the moment, but I've pretty much stopped using anything else now. I think it's already very good.

Long time Arduino user who enjoys DIY audio and AV equipment.

Go Up