Admin Visual Micro - Arduino IDE fun for Visual Studio

Arduino - Learning by Example using Visual Studio and APM

by Visual Micro 24. August 2012 13:02

Selecting an Arduino development tool that provides code assistance is a big help for new arduino users and also to users who are new to a particular arduino program. Features that can be very useful are:- help, examples, code completion, error correction and intellisense.

Help and Examples

Arduino provides a number of examples to help us understand the basics of micro-controller development. Many arduino libraries, created by the community, are also provided with examples.

The "File" menu in the Arduino IDE provides access to all of these examples. In the Arduino IDE we click an example to open it as a new sketch project. In the Arduino IDE, that editing and saving the example will be replaced with modified code. In Visual Studio we get to choose if we would like to create a copy of an example or use the original. We also get a few others options described later on in this page.

Examples are a useful facility and are often overlooked by new users. Examples help us understand the core components of any arduino project. By understanding the core components such as sensors and servos we are able to then create or understand larger Arduino programs.

A good "example" being the ArduPilotMega (APM) drone project. This project has resulted in a few massive but highly crafted arduino programs such as ArduPilot and ArduCopter. The APM hardware involves sensors such as 3 axis:- giro, accelerometer, compass and a gps. The hardware can also drive servos or electronic speed controllers (esc) for rc cars, planes, copters and boards. The heart of the APM circuit board is a standard Arduino micro-processor with some additional sensors ++.

Micro explorer showing apm examples and error correction

At this point I should add that there are other drone projects that use a variety of other arduino based solutions, I am not recomending which is the best I am simply using APM as an example. A reason for using APM as an example is that the project is so incredibly well written, it is an enourmous project that has been re-worked almost to perfection (from an arduino programming point of view!). The code is well formatted, the program is very flexible and can optionally include a large number of different types of sensors (and options). 

A great benfit for new APM users are the examples provided by the diydrones.com community. Every variation of every sensor supported by diydrones.com programs written for APM is available as an example. This makes it possible to write small simple experimental programs or use the examples as they are. These small programs are a great wayt to understand how each sensor, servo, motor, esc, etc. works.

The Visual Studio Arduino plugin provides the micro explorer tool  (shown above) includes these examples but also other reference and tutorials.  The explorer allows arduino examples to be opened, new arduino projects to created from examples and/or to simply open individual example sources for inspection (or copy/paste).

The explorer provides the same refererence examples that are available in the arduino ide with the addition of advanced references for the AVR microcontroller and gcc compiler. The latter being useful for more advanced users. A custom google search facility fixed to arduino.cc, arduino wiki, arduino forum and visualmicro.com provides a "www search" without leaving the Visual Studio development tool.

Arduino Code Completion and Intellisense

In the picture below you can see the micro explorer tool providing a drill down into the APM/Arduino example sources. The image also includes source code with an inteltional error to demonstrate Arduino code completion and error correction in Visual Studio.

Pressing the '.' (full stop) automatically displays a list of available members of the object called g in the ArduPilot project. Pressing F12 will goto the definition of an item. SHIFT+F12 will find all references to the currently selected code. All these functions and more are on right click menus and the menus at the top of visual studio.

How to explorer an arduino project using Visual Studio intellisense

References

For Arduino development, if you do not have a copy of Microsoft Visual Studio then grab a copy of Atmel Studio which is based on Visual Studio 2010 and is free

The Visual Micro plugin for Visual Studio can be downloaded for free from www.visualmicro.com

 

Support this project and share this post?
  • Facebook
  • Google
  • TwitThis
  • LinkedIn
  • Reddit
  • StumbleUpon
  • del.icio.us
  • msdn Social
  • DotNetKicks
  • Tumblr
  • MySpace