If you frequently use Arduino, you will find the IDE more than limited, and lacking most of the functions that are expected in a modern IDE.
In this previous post we saw how to set up Eclipse as a good alternative for developing in Arduino under the Linux environment.
However, the best available option for developing in Arduino is to use Windows and Visual Studio, its all-powerful flagship IDE. With a big difference, even if it’s hard to hear for open-source lovers.
To be able to compile and upload programs to Arduino from Visual Studio, it is necessary to add an extension called Visual Micro. This extension also allows you to work with a wide variety of development boards, in addition to, of course, all Arduino models.
Before you have time to worry about its price, we have yet to mention the best part. Both programs, Visual Studio 2015 and Visual Micro, have free versions for non-professional use.
If you really want to unleash the full potential of Arduino and become expert developers, it is recommended (and almost mandatory) that you try the advantages of using Visual Studio and Visual Micro with Arduino. Let’s go over some of these advantages.
Advantages of Visual Studio and Visual Micro
Formats and colors
Colors for different types of objects, libraries, and variables. No more straining your eyes on the dull colors of the Arduino IDE. Distinguish the main parts of your code at a glance.
If you are a purist in programming, mismatched lines and tabulations with different spacings will make you nervous. Visual Studio takes care of fixing this for us, automatically indenting the lines.
Intellisense, the writing assistance system for the programmer, is one of Microsoft’s greatest achievements in Visual Studio. It allows us to complete variable names, get object methods, and use shortcuts to quickly write basic structures like loops and conditionals. Simply an essential function in any modern IDE.
Multiple projects in solutions
Finally, some order in our Arduino projects. Thanks to Visual Studio, we can create solutions made up of more than one project such as the code of a sketch and its associated libraries and classes.
Code in real C++
Another huge advantage, no more struggling with the IDE and its “interpretations” of C++. No more having to extract most of the code as libraries to use objects. With Visual Studio and Visual Micro, you can use the full power of C++ to program your Arduino.
Compilation from Visual Studio is really fast, about twice as fast as the standard Arduino IDE in Windows (which, on the other hand, is terribly slow). The generated code is exactly the same, and has the same optimizations, so it takes up the same memory in Arduino. Simply put, Visual Studio is faster.
The Standard IDE is quite stingy in words when it comes to indicating errors in our programs. Visual Studio will not only indicate the errors and the line on which they occur after compilation, but it will also underline the errors as we write them.
Visual Micro has an explorer that allows easy installation and management of libraries. It also allows you to manage the different development boards available, and the examples.
Debug (Pro version only)
Visual Micro has a Pro, paid version, that allows you to debug Arduino from Visual Studio. A very powerful feature, which is an invaluable help for professionals.
However, if you are an enthusiast and do not want to pay for the Pro version, don’t worry. The Debug feature is very specific for professionals, and the free version is perfectly functional for the vast majority.
How to install Visual Studio and Visual Micro
Installing Visual Studio is easy. Simply go to the download page, and download the Community Edition.
Run the installer and make sure to install the C++ language.
When the installation is complete (it’s a lengthy process) go to the Visual Micro download page and install the extension.
Finally, it is convenient to go to “Options/Text Editor/C++/Advanced” and activate the Fallback location, to prevent a ‘ipch’ directory from being created in each solution, a process that takes time and space and adds nothing.
Ready, you can now use Visual Studio and Visual Micro to compile and upload your programs to Arduino, and many other development boards. It’s like going from using an old, rusty bicycle to a Ferrari!