Using Code Explorers and Diagrams to Learn Arduino

The free Arduino Plugin for Visual Studio 2012 provides some very useful tools that makes learning Arduino a little bit easier. (Read how to get Visual Studio for free at the end of this post)

One of the tools is the "Class Diagram" which is available to all components of any Arduino project. Below you can see the relationship that exist in the Ardino core to the "Print" class.

Development of both simple and advanced Arduino projects benefit from being able to quickly visualize and understand the code.

The free Arduino pugin for Visual Studio 2012, 2010, 2008 is available from here.

Instructions of how to download a legal copy of Microsoft Visual Studio 2012 Professional for free from here

Edit: Based on feedback from experienced users I have altered the picture to show a slightly simpler representation. The previous image showed all the Arduino connections to the Print class which was a little more complex.

I don't know about you, but that diagram does not do anything for me.

I know what you mean. I used to get massive wall charts like that with each release of Delphi. They always stayed folded up in the box.

Instructions of how to download a legal copy of Microsoft Visual Studio 2012 Professional for free

Provided that you agree to have published a web based application through the WebSpark site within the first year, and keep your details regularly updated during the three year period.

@CrossRoads, I wouldn't expect seeing the relationships of the Print class to do much for a global moderator :slight_smile: However, as an experienced user I think it is easy to loose sight of what new users do not know.

I think that new users trying to learn inheritance and how to structure code correctly will find this feature very useful which is why I specifically added this post to the "Education & Teaching" board.

No matter which project users might become involved with, the first job is to understand the structure of the program code. Being able to pick ANY class or area of code and have an diagram displayed instantly on the screen is very useful, as are other features of Microsoft Visual Studio such as jump to definition and code suggestions/completion.

Before looking at the diagram I wasn't entirely sure of the relationship the Print class has with other core Arduino code. I could have added a more complex example but I wanted to stick with something that most people will already be using, HardwareSerial (Serial.print) seems one of the the most common Arduino examples.

In the example in my first post, we can see how the arduino HardwareSerial is inherited by the Stream class which in turn is inherited by the Print class. The Arduino addin for Visual Studio will automatically recognize all Arduino projects and seamlessly configure Visual Studio to provide a 100% compatible Arduino development environment. So we get best of all worlds and a very informative programming tool.

I appreciate your feedback and will take some time over the next week to post more examples that might show the benefit of the Visual Studio code explorers in more detail.

In the meantime here is an example of what I believe is very useful. The largest Arduino project I know of is the APM project at diydrones.com. Apm is an extremely efficient Arduino program that supports a huge range of different sensors. The design of the apm gps class should be a good lesson for many new users, especially students attempting to increase their expertise in C++/Arduino programing.

Below is a dynamic class diagram of the apm gps system. In my own geeky way I love how easy it is to understand this clever code using Visual Studio

Incidentally, the ground control telemetry project at diydrones is open source and is also built using Visual studio.

@dxw00d, yep the free tools also allow us to build windows, mobile and web applications. So we can build telemetry apps that display data from our Arduino projects or we can build Arduino programs. There are hundreds of thousands open source examples that we can modify, then we can even upload them to WebSiteSpark. However, it isn't policed that strictly so as long as we are learning Visual Studio then I am sure Microsoft won't complain :slight_smile: As concerns keeping your details up to date, that isn't very difficult and it's worth it for so much pro software for free.

Yes, you are constantly pushing this 'free' offer, but not explaining that it isn't a free lunch, and that there are obligations placed on you for using the software. MS provide the express versions for those that do want to legally download VS for no cost at all. The WebSpark program was not intended to provide freeloaders with a full copy of VS.

as long as we are learning Visual Studio then I am sure Microsoft won't complain

Because, of course, you purchase a full license when the free one expires at the end of the three years.

@dxw00d I don't that only Microsoft can comment on what the program is intended for. The few soft obligations do not cost any money, the product is free. I get many emails of thanks each week from the many users who are enjoying the free software and finding their Arduino coding to be much more fun. Some people have even blogged about it all so it is free and they are very happy.

In the last year Microsoft has relaxed the rules, previously we had to be considering a career in web design to gain Visual Studio and 1000's of dollars of extra software for free. The new rules are quite clear and can be found here (the eligibility statement from Microsoft)

Who is eligible for WebsiteSpark?
To be eligible for WebsiteSpark, you must meet one of the following criteria at the time of joining:
Company: A privately held professional service firm whose primary business is providing Web development and design services for its clients and has no more than 10 members, which includes owners and employees (maximum of 25 members for Brazil, China, India, and Japan),
or
Individual: An individual that does not have his/her own company and/or does not work for a web design or development company.

BUT let me be even clearer that this is a free offer open to all. Back in November 2011 Microsoft decided to blog about the Arduino plugin for Visual Studio. In the comments of the blog I openly raised the point that Visual Studio can be downloaded for free. You can read the blog and the discussion on the Microsoft Codeing4Fun Blog Shows | Microsoft Learn.

Microsofts Blog Title: Visual Studio 2008/2010 and Arduino? Yep!

While I don't usually highlight Arduino related projects, since there's often little Microsoft relation, I saw this and knew I had to post on it... I mean how much more Microsoft can you get!

A complete Arduino development system for Visual Studio 2008 and 2010

From my point of view I am very happy that this free solution is available to everyone. There is no cost to signing up and getting this software and there is nothing hidden or underhand about what we are doing. This solution helps so many people learn and program Arduino, I don't know why anyone would be negative about this free solution or why they would try to take this away from the community?

I'm not trying to take anything away from anyone. I am just trying to point out that it isn't simply a free lunch. If it was, there would be no need for the express editions of Visual Studio. At the end of the three year period, your license expires, and you should then purchase a full license to continue using the software (with the exception of Expression Web, which you get to keep), or stop using it.

Yes you are right but who knows what will be available in 3 years. I am working on a version for the free Atmel studio which is also a version of Visual Studio (but not as functional as vs pro).

3 years is a long time, it would seem a shame to miss out on an easier and more fun environment just because it might not be free in a few years. To be honest, if I hadn't of written the plugin I would have moved away from Arduino a long time ago. It has been a lot of hard work but the end result is great fun and removes much of the constant need to look for Arduino reference guides.

I do see your point, I used to make a big thing of the three year time limit but in the end decided it is not a reason to avoid using the tools and that the 3 year limit is always clearly shown on the page that I link to.

I got burned by the "free" visual studio twice. So I will happily use it work but definitely not at home. With regard to the print class diagramm: it makes it blindingly obvious that the design for print is somewhat screwed. But I do not see how this facilitates any in depth understanding :wink:

Hello, I am sorry to hear that, I am struggling to understand how you can get "burned" downloading free software direct from the Microsoft web site? If you can please explain so that I can add a knowlege base article of your experiences.

If it helps, here is a link to a page published today by a new user that has happily installed Visual Studio and the Arduino plugin. The publisher has just joined the debug tool beta group so the article covers some extra stuff that you can ignore.

With regard to the print class diagramm: it makes it blindingly obvious that the design for print is somewhat screwed

It's very good to hear that seeing a graphical diagram can also be used to identify coding mistakes. In terms of understanding, it's just an example, maybe my 2nd example in this post is more relevent for experienced users.

I can say that we have good feedback from the people that are actually working with the 2nd example.

Microsoft's free offer or not aside, it just at first appearance to me looks like that the MS studio IDE is much more intimidating and complex compared to the the very simple and easy to use and understand arduino IDE. I came to arduino with a lot of hardware experience but limited software experience. My limited experience was with Borland's original Turbo Pascal IDE. I found the Arduino IDE very easy to figure out from the very start, I think because of the few choices one has to figure out to get a sketch entered and verified and/or uploaded. I suspect I would have passed on the whole arduino platform if I was first presented with the studio IDE to navigate on my own.

So ease of use for raw beginners compared to the arduino IDE? Color me very very skeptical of that claim, unless you have hard data to back that claim, rather then just an opinion?

Simplicity is one of the corner stones that made the Arduino platform the success that it has become. A professional IDE does not seem to me to met that objective.

Lefty

Hi Lefty,

I agree that without the plugin Visual Studio would be as impossible for new users as Eclipse, Netbeans or any other IDE than the Arduino.

However, the plugin does what the Arduino IDE does and is installed from a one-click installer. It makes things very easy yet provides intellisense suggestions and help.

Code completion suggestions as we type make it a must for anyone who does not know the Arduino syntax and especially for new users.

NB: If Eclipse is your preferred route then there is a great Eclipse plugin that also helps. As a Microsoft user I prefer Visual Studio but everyone has their own preferences

There is one click compile and upload, board selection, serial ports and a simple sketch creation system that just requires the name of a sketch. It's that easy!

There are plenty of articles on the web, not authored or associated to me, from people who are pleased to have this option instead of the Arduino IDE. I can provide some links if required but we all have google :slight_smile:

The plugin is free, there are no adverts on the visual micro web site and a forum/wiki is also provided free. It is a great option for many and this is the right place to tell people about it.

Below is an example that shows how we have, in Microsoft Visual Studio, the same simple options that are provided by the Arduino IDE. I know the image shows two Arduino projects open at the same time that some might consider confusing but this is an optional feature that I like to use in my testing. I also recognise some extra clutter on the tool bars which can be hidden using the right click menu. However, the "clutter" can be ignored, there are no options that need to be set other than a serial port (or programmer) and the board.

Finally, I do appreciate that there are many different types of "new users". I speak for the ones like myself a few years ago when I was suprised to find how little support the Arduino IDE provided. I had to search the web or open an example to learn every single command. I found it a painfully slow and fustrating process.

I'm happy to see you mention my "completely free open source plugin" (At least I hope it is eclipse.baeyens.it you are referring to). :smiley:
Not sure how it compares to the visual studio plugin so I can't confirm/deny that it "is not as easy as Visual Studio". I hope you know what you are talking about.

I have been in software development for decades now with lots of different IDE's (amongst them microsoft visual studio) and from my experience I'm completely with Lefty when he states

just at first appearance to me looks like that the MS studio IDE is much more intimidating and complex compared to the the very simple and easy to use and understand arduino IDE.

The Arduino IDE is extremely simple letting the newbie focus on the important stuff. Any real IDE is to complex for a newbie. There are to many windows; to many buttons; to many short cuts; to many menu items; ....
I considered (but rejected) to make an "arduino simple perspective" in eclipse to have the same simplicity in Eclipse as the Arduino IDE offers. I decided not to do so because I would have to spend lots of time and never get to the Arduino IDE simplicity. Even if I could I would lose the power of the IDE.
What I'm trying to say: You have developed (or are supporting) a very well written free plugin in one of the worlds best (commercial) IDE's. Which is great work which will be appreciated by many. However any statement in the sense of "as simple as the arduino IDE" is undermining your credibility amongst the more experienced of us.
This is what makes me say "I hope you know what you are talking about." in the first part of this response; cause I think you do not.

All the best to you
Jantje

Hi Jantje,

Well it's always interesting to hear the opinions of god members :slight_smile: I've looked at your eclipse plugin and as I said earlier it really helps but the install instructions alone are more complex to use.

I found installing Eclipse to be quite difficult so, unrelated to your plugin the Visual Studio install was easier.

As I have said before, what is a new user? I speak for people like myself that found the Arduino IDE very difficult to work with without intellisense. I also found that when loading existing Arduino projects it was very difficult to see how code was related. In Visual Studio we just right mouse click any code syntax to GoTo definition or to "Find all references". As a new user to any project this type of tool is VERY useful.

So this is a preference for some to have a full interface and good source navigation/help and for others an empty clean interface and no source code help. I don't think anyone can say which is the best. It is that all options are right but for different groups of users. It is up to each user to decide what they choose.

The Arduino Examples and Documentation explorer in Visual Studio allow users to easily open or clone existing Arduino examples which is great for new users. The Arduino IDE has some of this functionality I don't believe Eclipse has this yet.

Anyway I am not going to get into a bun fight. I am sure that Eclipse has some features that are not available in Visual Studio, I just found it a terrible pain to install and very difficult to use.

So I believe, from my perspective and many of the users of Microsoft Visual Studio perspectives that I do know exactly what I am talking about.

Thanks again for your feedback

Okay I have relooked at my words and altered them slightly. For fear of getting off point I have altered my statement to...

NB: If Eclipse is your preferred route then there is a great Eclipse plugin that also helps. As a Microsoft user I prefer Visual Studio but everyone has their own preferences

XD

Hello, I am sorry to hear that, I am struggling to understand how you can get "burned" downloading free software direct from the Microsoft web site?

Download a "free" version and ignore the fine print that says that you will have to pay for this "advanced" "free" version later on. Start to develop with said "free" version and figure out later to either

  1. pay
    or
  2. rework part of your stuff to work around the pay part.

With other words it is not free. Not like in "beer" and not like in "speech". More like in "drugs".

It's very good to hear that seeing a graphical diagram can also be used to identify coding mistakes. In terms of understanding, it's just an example, maybe my 2nd example in this post is more relevent for experienced users.

The coding mistakes where obvious from the code as well. Just not so graphic :wink:

I am sorry to hear of your experiences but they are not relevant to this discussion for the following reasons:-

  1. Our sketches in Visual Studio are always 100% compatible with the Arduino IDE so there will never be the re-work you experienced with your non-Arduino projects. This is already proven because users already have the option to switch between Arduino IDE and Visual Studio at any time

  2. There is no obligation to buy any software from Microsoft, my instructions about this offer have always stated VERY clearly that this is a 3 year free offer, as have Microsofts instructions. You do not have to read the small print to know this information. I always link to the same page about this free offer. The page title in bold states free microsoft software for 3 years, see for yourself, it is very clear.

  3. At the end of the 3 years all Arduino projects will continue to provide intellisense in the free express version of Visual Studio. At that time users will need to switch to Arduino to upload but this is common for other less capable plugins so nothing new. At the end of the 3 years users will have to switch to Arduino to burn boot loaders but most other plugins don't provide this feature anyway

Our community is currently expanding at approx. 70 new users per day and has done so for some time. We have great feedback from many very happy and relieved Arduino programmers. This includes both novices and experts. The free offer that I have brought to peoples attention has been appreciated publicly in various blogs by happy users.

I have ensured that every feature of the Arduino IDE is available in Visual Studio, I do not request donations in return for adding what I consider to be fundamental features to a fully compatible and easy to use Arduino alternative.

There is nothing that the Arduino IDE can do that Visual Studio can not do but there are lots of things Visual Studio can do for Arduino that the Arduino IDE can not do.

Our setup and installation motto says something that other plugins are unable to say:-

If it works in the Arduino IDE then it will work in a valid copy of Visual Studio Professional. It is that easy!

I accept this solution is of no interest to some people on this forum but many other people have and are benefiting every day. Many of these people have read this and other Visual Micro articles and have happily benefited.

My posts are for the people who want to benefit from this information. If you don't like it and have nothing positive to say then maybe I can politely ask you to go and be negative elsewhere.

http://www.visualmicro.com

Hello, I am sorry to hear that, I am struggling to understand how you can get "burned" downloading free software direct from the Microsoft web site?

I am sorry to hear of your experiences but they are not relevant to this discussion for the following reasons:

Seems your question was not relevant to this discussion in the first place. Sorry for answering it.

100% Arduino compatible Visual Studio Professional works in the same way that we expect other professional editors to work, such as the spell checker in Google Chome or Microsoft Word.

Modifying Arduino code will automatically display intellisense (code explorer) whilst at the same time highlight errors. Mistakes in code are automatically highlighted in red squiggles and suggested corrections are automatically displayed.

The image below demonstrates automatic error detection and correction in Microsoft Visual Studio 2012 for the Arduino ArduPilot drone project. Notice the letter 'x' has been mistakenly appended to 'handle_no_commands()'.

These features are a HUGE time saver for new and experienced Arduino users!

References

Download and read more about the free Arduino plugin for Visual Studio Professional

Visual Studio Professional can be downloaded for free using these instructions.