How to Install a Library in Arduino IDE

About This Tutorial
This tutorial discusses what is are libraries, how to install them and include them in Arduino IDE sketches.
Tutorial Info
Programming Platform:
Difficulty:
Estimated Time (hrs):
2

Components Required

ImageComponentQuantityAvailable in Kit
evive1
USB A-B Cable1

Introduction

A library is a group of functions and declarations, that are used in Arduino IDE scripts. The library consists of an interface expressed in a .h file (named the header) and an implementation expressed in a .cpp file. The header file contains all the declarations and the .cpp file contains definitions of functions declared in the header file.

Libraries make it easy to connect to a sensor, display, module, etc. E.g. if you want to control your evive TFT display, you can use the evive Library. It has predefined functions for writing text, drawing a line and many more. It eliminates the need to make complicated functions on own; the user can simply use the corresponding library.

Installing a library

There are three ways in which you can install a library:

  1. Using the Library Manager
  2. Importing a .zip Library
  3. Manual Installation (Not covered in this tutorial. To know more visit here)
evive Alert
For installing evive library, only method 2 and method 3 are recommended.
  • Using the Library Manager

Follow the steps below to install a new library in Arduino IDE using the Library Manager:

  • Open Arduino IDE and click to the Sketch tab. Then, click on Include Library > Manage Libraries.

Manage Libraries

  • The library manager will open and you will find a list of libraries that are already installed or ready for installation. Scroll through the list to find the library you want you install; then select the version of the library you want to install. Sometimes only one version of the library is available.

  • Finally, click on install and wait for the IDE to install the new library. Downloading may take time depending on your connection speed. Once it has finished, the Installed tag should appear next to the installed library. You can now close the library manager.

  • Importing a .zip Library (evive Library Installation)

Libraries are often distributed as a ZIP file or folder. For this example we will import evive library. You can download it from here. Generally, the name of the folder is the name of the library. There will be a .cpp file, a .h file, often a keywords.txt file, examples folder, and other files required by the library inside the folder . DO NOT unzip the downloaded library, leave it as is.

Follow the steps below to import a .zip Library:

  • Open Arduino IDE and click to the Sketch tab. Then, click on Include Library and select Add .ZIP Library; you can find it at the top of the drop-down menu.

  • You will be prompted to select the library you would like to add. Navigate to the evive.zip file’s location and open it.
  • Return to the Sketch and select Import Library menu. You should now see the library at the bottom of the drop-down menu. It is ready for use in sketch. The zip file will have been expanded in the libraries folder in your Arduino sketches directory.
evive Notes Icon
The Library will be available for use in sketches, but examples for the library will be exposed in File > Examples only after you restart IDE.

How to include a Library in your Sketch

Follow the steps below to include a library in a sketch:

  • Navigate to Sketch > Include Library and select the library you want to include.

Add evive Library

In this example we are going to include evive.h.

Included evive.h

evive Notes Icon
If you are facing any problem, or are unable understand some steps, please reach out to us on our forum.
This Helped
This didn't help
Share this Tutorial
Facebook
Twitter
Google+
Pinterest
Reddit
Print
Related Tutorials
Featured Projects

Leave a Reply

Close Menu
×

Cart