I'm a big fan of Microsoft .Net Framework and Visual Studio since 2005. It is my super-favorite IDE. As time goes on, I become a bit lazy to write code without IntelliSense as I'm used to it and always tries to find way to integrate other programming languages into Visual Studio that are not officially yet supported.
You can skip to Installation if not interested in story.
Last year (2015), in a Hackathon, I was using Particle Photon to build project related to theme "Connect the Unconnected India". It was my first experience with Particle Photon. The most horrible issue I faced was Particle's online IDE (not criticizing at all but I'm used to with Visual Studio's IntelliSense. Particle's cloud IDE is really a good IDE and I'm respecting it). And thus I was finding way to integrating Particle's libraries, compiler and flasher into Visual Studio. Finally, I managed to integrate them and created a Particle Photon project template for Visual Studio 2015 with following features:
- Project can be configured to target specific Particle Photon using its DeviceID (HEX String, can be retrieved using "particle identify" in CMD)
- IntelliSense Support for Particle Photon's Library
- IntelliSense Support for User Defined Custom Library (I've nothing done in this case, its default in Visual Studio)
- Compilation and Flashing of the project is done using "CTRL+F7" key combination
This technique is not meant for any commercial use though anyone can use it and modify even for commercial as well as personal use (but be sure to check Visual Studio 2015 Community's license guidelines. As per Community license, only 5 developers in an organization can use it for free.). There might be bugs, so let me know when you face any.
- Windows 7/8/10 running computer
- Visual Studio 2015 Community with Update 2 or newer (Download) [Install with VC++ support]
- Node.Js for Windows (Download)
- (OPTIONAL) - Python 2.7.x for Windows (Download) [Download 2.7.x version only because 3.x.x Python version is not checked yet and may be incompatible]
Node.Js is required in order to work with Particle-CLI.
Step 1: Install Node.Js
Nothing new. Just make sure to enable "Add to PATH" in Custom Setup wizard (see Step 1-d).
Skip to next step if NodeJs is already installed.
Step 2: Install Python Tools for Windows (Version 2.7.x) [OPTIONAL]
Make sure to enable "Add python.exe to PATH" in Customize Python 2.7.x wizard page. (See Step 2-c)
Skip to next step if Python is already installed or if you do not wish to install it as it is optional and only meant for future expansion of VS tools for Photon.
Step 3: Install Particle-CLI
Open Command Prompt and type:
npm install -g particle-cli
Skip to next step if you have already setup your Photon before and logged into particle-cli via CMD. Make sure to note down your Photon's device Id. Find my Photon's device Id.
Make sure to update your Particle-CLI (if already installed) using:
npm update -g particle-cli
Now, login to your Particle account and setup your Photon(for first time users, refer Particle Support page) by typing:
Follow on-screen instructions to login and set your Particle device if you haven't done it before or refer Particle's Docs to login or signup to your Particle Photon.
NOTE: You must need to be logged in to your Particle account. To do so, open CMD and type
particle loginand follow on-screen instruction. If you have not been logged in to your Particle account, compilation & flashing will not be done at all shall tend to error.
Step 4: Setup Header Files & VS Project
I've developed a utility which setup and configure your VS for Particle Photon.
Download utility "Particle Photon Tools for VS" and start program to begin installation. This program will automatically configure Particle Photon header files and VS Project for you. Utility should look like:
Hooray :) you have now Particle Photon project in Visual Studio 2015.
Now, Open new instance of Visual Studio 2015 and create new project. Particle Photon project will be available in Visual C++ templates. It should look like:
Before compiling & flashing your Photon over cloud, do make sure whether it is connected to the internet or not. If it is not connected, VS will generate error while flashing.
It was a quite difficult to manage Particle Photon in VS (it might be simple for some VS geek :D ). So far for this initial release; IntelliSense, compiling & flashing over Particle Cloud has been integrated.
In future, it may be possible to integrate debugging capabilities (if I was able to understand how to integrate external debugger with VS) as well as compile & flash locally.
Feel free to contact me for any query or issue.