Adding Libraries to your Sketch

What are libraries?

Libraries are program modules that other people wrote and that you can integrate into your project in order to use them. The classic Arduino IDE comes with lots of libraries for purposes like controlling stepper motors, reading and writing the EEPROM and so on.
You can find a description of available Arduino libraries on the Arduino homepage.

To add a library, choose vMicro > Add Library.

Add Library

"All Built-In" will let you add a library that comes with the Arduino IDE or that was installed by your hardware manufacturer

"Current Platform" lets you add libraries available for the platform selected.

These may change when selecting a different board/platform.

"User Installed" lets you add libraries that you created yourself.

Read below where Visual Micro searched for built-in and user libraries.

Advanced Library Options:

"Create Shared Project when Including Libraries" Generates a Shared Project when adding the library to your solution.

These are still references to the origonal library, so still Automatically Update

"Clone For Solution When Including Libraries" Clones the Library into the Solution before adding to your project.

"Clone For Project When Including Libraries" Clones the Library into the Project before adding to your project.

"Use Library Version in Clones" When set this will include the version number in the names of the cloned Libraries

Further explanation of these options and use-cases are below.

Note IconNote:

You will find the same menu items in the    Micro Project   menu / toolbar.


Visual Micro automatically adds the necessary include directives into your code:

Include File Added

Adding Libraries Video

Below you can see a video of our Library management and the Cloning options in action (Enable Subtitles).

Advanced Library Usage

To ensure you can harness libraries in the variety of ways required, vMicro's options allow the below use cases to be easily satisfied:

  • Single Library Shared into Multiple Projects
    This is achieved by simply selecting the "Create Shared Project when Including Libraries"
  • Different Library Versions within a Solution
    This can be achieved using the "Clone For Project When Including Libraries", which avoids conflicts in paths, and these cloned libraries no longer auto update.
    To make the versions easier to track and see in the IDE, enable the "Use Library Version in Clones" option.
  • Library for use with Version Control
    Depending on whether there need to be different versions of the same library available within the solution, you can choose to clone the library either for the whole solution, or the specific project.
    To make the versions easier to track and see in the IDE, enable the "Use Library Version in Clones" option.
  • No Auto-Update of Libraries
    Simply enable Clone to Solution or Project depending on your needs.

Installing new libraries

You can install additional libraries that you downloaded from the Web with the Install Library menu item.

You can open a ZIP file containing a library, and Visual Micro will install it in the user library folder. From then on, you can add this library to your projects as described above.

If installing from Git, you can use the repo or releases ZIP link, and simply paste into the file prompt when using the Install from ZIP option, as shown below:-

Warning 16 Note:

Do not forget to use the   Refresh   menu item to make the newly installed library appear in the "User" selection box!

Search path for user libraries

Visual Micro searches for user libraries in the "Libraries" subfolder of your sketchbook folder, provided you have specified a sketchbook location in the Configuration Manager.

If you did not specify a sketchbook location in the configuration manager, then Visual Micro searches in the "Libraries" subfolder set in Arduino IDE [file>preferences>sketch book location]\Libraries. Otherwise "My Documents\Arduino\Libraries" is used by both vMicro and Arduino IDE.

User Libraries

1 is the user libraries folder, 2 are your sketch folders.

For every library, you must create a subfolder in your "Libraries" folder:

User Libraries Subfolders

Installing Additional Libraries Directly From the Web

The "Add libraries" menu lets you choose among those libraries that are installed and available on your PC.
You can install additional libraries directly from web sites using the " Manage Libraries " tab of the Visual Micro Explorer.

Access via the "Micro Project" Toolbar

You can also access the "Add Library" function via the "Micro Project" toolbar. To make this toolbar visible, right click on an empty space in the toolbar area and select "Micro Project":

Micro Project Toolbar 

Adding Libraries the "Arduino IDE Way"

Traditionally, that is, in the original Arduino IDE, you can add libraries simply by adding an #include statement into the main .ino file.

For several reasons, this is not recommended with Visual Micro, for example, Visual Micro updates the Visual Studio Intellisense after adding a library, so that you will be offered the libary functions with Intellisense. This won't happen if you add libraries simply by adding an #include.