Use Visual Studio Code for your Particle development needs


#1

Hey,
if you are a fan of Visual Studio Code I wrote an article on how to use it to build and flash your Particles in Hackster:

enjoy!
Gustavo.


Visual Studio Code IDE - Particle Development setup
Nifty Shell script for compiling and then uploading to device
My initial impressions on Particle DEV
Teaching Electron Programming
#2

Looks pretty good !
The only drawback is that I can’t configure the include path…
I updated my c_cpp_properties.json file with the following:

[...]
"includePath": ["c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
    "D:/Projects/Dev_WTY" ]
[...]

where the second path is where I stored the libs like OneWire. I’m still getting the message :

TemperatureSensorDS18XX.h:24:29: fatal error: OneWire/OneWire.h: No such file or directory
#include "OneWire/OneWire.h"

and of course, the file exists as D:/Projects/Dev_WTY/OneWire/OneWire.h

Any clues ?


#3

Hi, are you getting that error when you try to compile? It so, I read somewhere that the particle CLI does not support include files, so you have to create soft links or copy all the lib files to the dir where you have your ino file.
Hope it helps,
Gustavo


#4

CLI does allow for subdirectories but your include statements need to be flat

//#include "OneWire/OneWire.h"
// needs to be
#include "OneWire.h"

#5

thanks @ScruffR!
So @YbuQc, maybe you should copy (or softlink) the directories of your libraries to the project folder, and flatten your include statements as ScruffR mentioned in his post below.
Let us know how it goes…
Gustavo.


#6

It’s indeed working if I perform a brutal copy.

Too bad, but for me it’s a no go. There is no way I will modify my code to accommodate a specific tool. It’s a shame as Visual Studio Code looks pretty nice and fun to play with. I’d lik to be able to use my code in either web IDE or a local tool, and this can’t be done right now.

Thanks @ScruffR and @gusgonnet for your help.


#7

That issue with needing to cater for different tools seperately will be sorted with Libraries 2.0 and IDEs 2.0, which also make importing other libraries a lot easier.


#8

Thanks for the info @ScruffR, that’s a very good news! Can’t wait to use IDEs 2.0 :wink:


#9

getting curious now where you got that info and when is the ETA for IDE 2.0 :neutral_face:


#10

@gusgonnet, as Elites we do get some peeks behind the scenes what’s going on and coming up and one of the bigger tasks Particle is currently working on is this Library 2.0 which is already undergoing some “early beta” testing and is a basis for IDE 2.0.
There is no official ETA but it’s rather high on the prority list.


#11

cool! that’s what I want to be when I grow up!!! :stuck_out_tongue:
thanks


Bypass Electron CLI OTA Flash Confirmation? [Solved - YES!]
#12

Please add these instructions to the tutorial to get OTA flashing to work with the Electron. Thanks!


#13

done, many thanks for the suggestion!


#14

Is this guide still accurate? I have lots of build issues when I try this. I guess it might be the IDE naming everything with a .ino extension and VSCode naming everything with a .cpp extension. I know there are caveats when switching between them, but I don’t know what they are. VSCode won’t flippin’ tell me. Compiling just tells me everything is SUPER WRONG

Actually, before that, is there any IDE environment that shows code problems inline, before you compile, for Particle devices? Compiling simply to check for errors is … non-optimal and only minimally helpful.


#15

If .ino poses a problem, just use .cpp and add #include <Particle.h> and function prototypes in all your .cpp files.


#16

still valid. I’ve been using it almost every day for the last 5 months.
if you include a library please flatten the directory structure so all lib files (.cpp and .h) are next to your .ino files.
Gustavo.


#17

Do I have to flatten all of the Particle headers also?

Before I even attempt to collect all of those things and put them in one place, does this IDE show you compilation errors before you compile like any other IDE made in the past 20 years?


#18

not sure what you meant. If those headers are included in the libs your proj is using then the answer is yes.

nope


#19

Are there any IDEs at all that do show compile errors before you build?

This is a basic thing I’m asking for. Just basic syntax validation and rudimentary type checking.

double radians(double deg);```

it's pointing at the 2nd ```double```, not the first.  that formatting is lost here.

I have dozens of compile errors like that.  This code compiles fine on the Web "IDE"

#20

Sorry that I sound super whiney, I’m having a bad day and am very frustrated with getting anything “off-road” working on this platform. The paved route is very well done, manicured, well-kept, etc. One step off that path and you are in the weeds.