Compiling, Uploading, and Running your Sketch

Note Icon Note:

First make sure that you have set up your board model and connection correctly, see here for more information

 

  • Start the compilation and upload process by clicking Start Toolbar Button on the Micro Project toolbar or with "Visual Studio > Build & Upload" from the menu.

Your sketch will compile, and after successful compilation, Visual Micro will upload it to your Arduino board.
As soon as the sketch is uploaded, it will start to run in your board.

You will see the compilation and upload progress in the Output Window. If the Output Window is not shown, you can make it visible with the View > Output menu item or by pressing [Alt+2] (not Alt+F2!)

Micro Build Window

Note IconNote:

If you want to use the debugging capabilities of Visual Micro, make sure to use the Debug configuration, selectable by this toolbar control:

Configuration Control in Toolbar

If you don't want to use debugging or if you want to build the final ("Release") version of your sketch, choose "Release" in the above control.

Read more about build configurations in this article.


If you only want to compile but not upload your sketch, click the Build Toolbar Button toolbar button or choose vMicro > Build from the menu.

Note IconNote:

If you have multiple projects in your solution, reading this page is recommended.


In the above example, Debugging was enabled, which causes two compilations, one without Visual Micro's debugging code, and one with the debugging code inserted into the sketch. (Advanced users can switch off the two stage compilation and save some time at the risk of getting hard to interpret error messages, should their code have errors.) You can see how much of the available program memory is occupied by your sketch.

As your project develops, you may want to add more source files and use Arduino libraries.
Read the following sections to learn more.

Using a Programmer for Uploading

Original Arduino boards and clones use the serial (USB) connection for programming (uploading) the sketch onto the CPU.
Other boards may also offer the option to use a programmer for uploading.
Users who build their own boards and use a socketed CPU may also want to program it using a programmer.

Using a programmer for upload can be configured in the vMicro menu or the Micro Programmer toolbar:

Programmer Toolbar

By clicking on the Programmer Toolbar Toggle Button button in the toolbar, you can switch the usage of the programmer on and off.

Performing a Clean Build

Visual Micro keeps track of changes to your files between builds  and rebuilds only those parts of your sketch that require it. This saves time in the build process.

However, sometimes, in advanced projects, changes to the #defines in the sketch code can cause custom core or libraries to require a complete rebuild. Editing library sources that are a dependency of other libraries can also cause the need for a complete rebuild.

In these cases you can clean your solution with the Build > Clean Solution menu item so that all compiled files are deleted. The next build will then rebuild everything. Of course, none of your source files will be affected by the "Clean Solution" command.

 

Other Pages