Visual Studio and Arduino

Following on from my little excursion into the Raspberry Pi world I thought I should make amends by mentioning the support that you can get from Visual Studio for Arduino development.

The Arduino IDE is pretty good in the main. It has a few clunky bits but it is fine for quickly getting some code running but issues do arise when the code base grows. I have tried the option to use an “external editor” with Notepad++ (which is a tool I use a lot in general code development) but it is still not an optimal experience. Some Arduino developers use Eclipse and I got a lot of experience with that tool when I first started programming for the Android platform before Android Studio became the norm. There is also Visual Studio Code which is another great tool and has a confirmed place on my Apple mac. For me though, the Visual Studio IDE is the “stand out” developer’s tool.

If you fancy the lighter weight Visual Studio Code then there is a great extension for that IDE in the Visual Studio Marketplace.

For Visual Studio itself then the Visual Micro extension is the real deal and has an optional (paid for) Pro version to support on board debugging.

You have to make sure you have installed the C++ option in Visual Studio before you install the extension but if you are a C/C++ hacker that is probably a given.

As my Raspberry Pi demo used the trivial (ubiquitous, even boring?)  “blink” then here is the same starter program for an Arduino inside Visual Studio. Note the selection of target board, COM port, Serial Monitor equivalent and the drop down listing installed and available non-standard libraries. An action packed screen shot if ever there was one.

Ignore the indicated X86 processor target as that has no function.

Clicking the “run” button deploys the program to the board and you can use the “Build” option to check for syntax errors. The big gain, of course, is intellisense assistance when writing code with auto completion plus support for large code bases.

Addendum

Followed up this post by building a generic C++ Map class that inherits from a Red-Black tree running on an Arduino. Memory constraints were tight but the development environment supplied by Visual Studio and this extension quickly ran down a few code issues and helped test the methods of this new class. Compile, link and upload times were shorter than those normal using the standard Arduino IDE and this reduced turn-around time was an unexpected bonus.

Edited 26/04/18 to add some links and the addendum above.

Comments

Popular posts from this blog

Unicode output from an Arduino.

Arduino: How to scroll long text on OLED screen

Arduino Regular Expressions