Go Down

Topic: Visual Micro - Arduino for Visual Studio (Read 18181 times) previous topic - next topic


Finally and at last there is an IDE solution that makes sense for non Linux users. Visual Micro or Arduino for Visual Studio 2010, has been released and it is absolutely great.
A whole lot of work has been put into this Add-in for Visual Studio to make it a seamless implementation of the Arduino IDE build rules into the VS environment. You simply load your existing sketch - no modifications - and away you go.
The Intellisense works great and all the features of Visual Studio are available to the programmer. Boards can be selected from a toolbar and multiple Serial Monitor windows can be opened simultaneously.  

Go to the Playground and have a look at http://arduino.cc/playground/Code/VisualMicro
Downloads can be found here visualmicro.codeplex.com
The creator's site is here http://www.visualmicro.com/

Rather people think you to be a fool than you open your mouth and confirm it.


That looks good, if it works as described it will be breath of fresh air to the whole VS/Netbeans/Eclipse/IDE/makefile/etc scene.

Unfortunately for me I only have VS2008.

Rob Gray aka the GRAYnomad www.robgray.com


It is just that simple. I do believe that the author will release a VS2008 version in the near future. There are some compatibility issues but they are working on it.
Rather people think you to be a fool than you open your mouth and confirm it.

I'd like to point out that avr studio 5 is basicly visual studio 2010. And you can use all the arduino libraries from it. Everything works. However there are a few things you need to do.

Create a new c++ project (install it under updates) Have a main that looks something like this:

Code: [Select]

#include <avr/io.h>
#include <math.h>
#include <util/delay.h>

extern "C" void __cxa_pure_virtual() {} //C++ compiler fix

#include "Arduino.h"

int main(void)
init(); //init the arduino, you must call this.
pinMode(9, OUTPUT);

while (1)
digitalWrite(9, HIGH);
digitalWrite(9, LOW);

return 0;

Also, under project properties->symbols you need to add F_CPU=16000000UL (or whatever speed your arduino runs at, mine is 16 mhz). Use an AVR programmer (or build your own with another arduino) to program it from in there aswell.

There you go, arduino in visual c++ :)


I agree and beg to differ - at the same time. Avr Studio 5 has it own compiler and does not always compile Arduino sketches. I have tried several complex sketches that just did not compile. In the end I gave up and went with Eclipse.

This add-in uses the Arduino environment as is and sketches compile first time. Sketches are also backward compatible with Arduino IDE. And you dont have to change any file.

Rather people think you to be a fool than you open your mouth and confirm it.

Can you give me an example of these "advanced" sketches? Because as far as i know, all the arduino software does is wrap your code around what i pretty much wrote here and then sends it to avr-gcc. I'd like to know what else it does. I know of a few hardcoded defines, like the arduino version (which is troublesome even in the arduino program as i've heard), but i can't think of any other.

Also a note, when you use eclipse, you're still using avr-gcc, which is exactly what avr studio 5 uses too. So there shouldnt be any differences there other then possibly the gcc version.


I don't think it is constructive to push one's own point of view regarding any matter, however I have to insist that the Avr Studio 5 does not use avr-gcc but their own compiler. A re-write of the avr-gcc compiler. It is not fully compatible. They, the Atmel team might be busy with a Arduino compatible add-in for the Avr studio 5, but it is only hearsay at this time. If the current version of AS 5 was compatible, why the need to create a special add-in. in the end, as long as we all have an environment that suits our needs, so be it.
Rather people think you to be a fool than you open your mouth and confirm it.

But do you have examples of those incompatibilities?


I have to insist that the Avr Studio 5 does not use avr-gcc but their own compiler. A re-write of the avr-gcc compiler. It is not fully compatible.

But you can use a toolchain of your choosing:




Well you see that is just the joy of having a free will. You do just as you please when you please. Not always to the joy of others, but so be it.
The purpose of this topic was just to introduce an alternative to the Processing IDE. A real simple way of doing things. It was never the intention to convince or compete. I take all the input as positive and agree with some and disagree with others. I am sure that there are as many ways to code as there are coders. This is my preference and I shared it with you.
Once the AVR team has integrated a plugin for Arduino, I will look at AS5 again.

P.S. I use AS5 for all my other AVR coding :D
Rather people think you to be a fool than you open your mouth and confirm it.

But you can use a toolchain of your choosing:



Thanks for clearing that up :)


Slightly off topic but still relevant to the discussion I think. I started playing with my Arduino again after a fairly long holiday from it. I found the USB driver chip was dead (no 3.3 V) and therefore I can't download sketches.

I installed AVR Visual Studio 5 so I could download a sketch using AVRISP MKII using the info in an old forum topic http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1196617535 . I now note the comments that it is not !00% compatible but this might do me until I can get another Arduino.

One thing I noted was the delay function in the simple blink sketch shown above is running too fast, maybe by a factor of 10. It certainly works as increasing the delay() parameter changes behaviour. I thought it might have been the CKDIV8 Clock fuse divider needed setting but I don't think this is delivering the right result. Does the Arduino use an external clock? Any ideas on how to set up the clock correctly?

Any ideas would be appreciated. If not, at least I can confirm an incompatibility to settle the argument.

Finally, can the new Visual Studio environment drive the AVRISP MKII ?




You can do everything that you can do with the Arduino IDE. The plugin uses the Adruino environment and tools. It is just located in the VS2010 IDE. You will have to look at the programmer and board settings in order to use AVRISPMKII

With regard to your timing issue. The Arduino board uses an 16Mhz external clock in the form of a crystal. You have to look at the fuses to start with and then at the F_CPU setting in the tool chain setup of project setup - not sure where. The delay function is very accurate and you should not have to change the way it is intended to be used. delay(100) must give a delay of 100 milli seconds.

My guess is that the fuses are incorrectly selected.

I use a very handy tool called AVR8 Burn-O-Mat. Google will tell. This tool helps to visualize the fuses to some extend and it is easier to keep track.
Rather people think you to be a fool than you open your mouth and confirm it.

Visual Micro

Oct 29, 2011, 10:18 pm Last Edit: Oct 30, 2011, 12:04 am by visualmicro Reason: 1
@Robindengen  - Arduino Compatibility and Ease of Use

1) There are various issues the slightly less experienced users will encounter with libraries outside of arduino or visual studio. If using either of the two products then, when adding a library all of the .h files are automatically added as #includes. I have found users who had manually included just one or two of the header files from the lib folder yet the folder also contained other .h files which contained errors. When we compile in arduino or in visual studio the lib folder is re-scanned and all the other .h files are included in the compile which will then fail if we have an error in a file. Libraries can also have a sub folder called /Utility containing more .h files. It is fiddly to find the names of the .h files each time you want to include a library in a sketch and adding them manually is prone to error. So this makes it easier to use arduino or visual studio to manage libraries than avr studio. Using visual studio will ensure backward compatibility with the arduino ide which is very important when searching the internet for code extensions or trying to diagnose problems

2) When a board is selected in arduino or in visual studio the proper cpu speed, defines etc are automatically applied for the user. So we don't have to remember or know these settings. When we use a programmer or burn a boot loader all of the settings are again automatically applied. Arduino also supports an additional core per board. The new core is automatically used by both arduino and visual studio

Example: The intellisense in visual studio will immediately show the additional serial ports when changing a board from uno to mega

3) Both arduino and visual studio do not require users to know avr files names or any arduino core file names

4) Your simple sketch example will look quite complicated to many users but let's consider a real life project that contains 10 libraries. We would like to be able to add 10 libraries easily by clicking menu items which will automatically insert between 10 and maybe 100 #includes into the source code. We would also like the intellisense to automatically detect where the libs are installed and finally when we compile it is very important that all of the full include paths are mapped correctly. Let's not forget that it is legal for arduino/processing libraries to contain a /utility folder. The utility codes needs to be known to the compile of the related library or things will break.

5) When we install a new version of the arduino ide we want all of our sketches to automatically use the cores and arduino libraries. we also want to use the same compiler that ships with the ide so that any errors can be resolved via searches on arduino.cc or by logging a problem with arduino.

6) If we are developing our own libraries then we would like the facility to automatically add all library code to the current project, not just as #includes but as source files. So that we can edit and browse the library codes easily. We want to include the lib codes into our project but for them to be automatically excluded from the primary sketch compile. This feature is only available in visual studio.

7) We want to download an arduino example from the internet, open the main .pde, select a board and click F5 to compile and upload. As long as the libraries are installed the sketch will compile immediately. In eclipse it might be up to 30 minutes of work to prepare just one example.

There are so many other benefits of the visual studiuo solution that I won't bore you with them. What seems great is having the power and speed of visual studio ide but with the simplicity of the arduino ide
Arduino for Microsoft Visual Studio Pro and Atmel Studio 6.1 http://www.visualmicro.com
Arduino Debugger http://www.visualmicro.com/post/2012/05/05/Debug-Arduino-Overview.aspx


From the horses mouth, and he professes to not have the gift of the gab.
Rather people think you to be a fool than you open your mouth and confirm it.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131