will be read-only starting December 31st, 2018. For more info please look at this Forum Post

Using Microsoft Visual C++ 2010 Express to write Arduino Sketches/Libraries

This is an approach to use Microsoft Visual C++ 2010 Express to develop for Arduino. This lets you make use of Microsoft's Free C++ IDE with its advanced code completion & intellisense features to program for Arduino platform as you get into more complex sketches & library development.

If you own a full paid version of Microsoft Visual Studio, you should probably take a look at which has more capabilities. Visual C++ Express doesn't seem to allow these add-ins.

The Approach

The basic approach is to code in Visual Studio & complie and upload using Arduino IDE. Arduino IDE has a very convenient "Use External Editor" option enables you to edit sketches elsewhere & simply click compile/upload buttons in the IDE. While, i'm certain it's feasible to call a "custom make script" from Visual C++, the Arduino IDE is so convenient that I haven't really bothered creating one :)

The Steps

1. Setup Visual C++ Express to recognize .ino files as C++
This gives you syntax highlighting & turns on intellisense in your sketch. In Visual C++ Express go to - Tools Menu->Options->VC++ project settings. Under the Extensions to include setting in the right hand side, add ;.ino at the end.

2. Create an "Empty Project" in Visual C++ Express
Ensure it's completely empty & has no templates & stuff created automatically. This Project will contain your Arduino Sketch. You can do this by File Menu->New->Project->General->Empty Project

3. Point Visual C++ Express to the right include folders for Arduino and AVR LibC headers
This ensures that AutoComplete/Intellisense can parse these library headers & show you code completions, help & syntax coloring for the Arduino environment. Do the following -
Step a: Navigate to Project Menu->Properties->Configuration Properties->VC++Directories
Step b: Click in the textbox next to Executable directories,click the drop-down button that shows-up & select edit
Step c: In the box that pops up, remove any existing entry using the delete button & uncheck Inherit from parent or project defaults
Step d: Repeat steps b & c for all the remaining directories textboxes
Step e: Click edit under the Include Directories and add the following directories by clicking on the new-line button (icon looks like a folder). In the list below, replace <Arduino> with the path to your root arduino folder

Step f: Finally in a similar manner, under Source Directories add $(ProjectDir)
4. Create your Sketch
To add a sketch - right-click either the Source Files or Header Files folders in the Solution Explorer, click add-item & add either a C++ file or a header file. Make sure you name your main sketch file as .ino and ensure it is saved under a folder with the same name without the ino extension. This is a requirement of Arduino IDE

5. Making sure Intellisense can pick up processor-specific defs
Add the following snippet at the top of each header file-

#ifndef __AVR_ATmega328P__
	#define __AVR_ATmega328P__
#ifndef Arduino_h
	#include <Arduino.h>

__AVR_ATmega328P__ corresponds to the processor in Arduino Uno, if you're using another processor, just lookup the right define in the io.h file - [@<arduino>\hardware\tools\avr\avr\include\avr\io.h

6. Open in Arduino IDE & click Compile/Upload You can go ahead and make any changes you want in Visual C++ Express and the Arduino IDE will pick it up. The only key requirement within Arduino IDE seems to be that the sketch must be placed under a folder of the same name :)