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

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

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

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

Note IconNote:

You will find the same menu items in the    Project   main menu.


Visual Micro will add the necessary include directives into your code:

Include File Added

Note Icon Note:

Under the "Core" menu item, Visual Micro always shows those libraries that fit to the selected board. If you switch to a different board you might notice that the list of libraries changes as well.

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 like described above.

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 a "Libraries" subfolder.

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.

Other Pages