How to Install a Library in Arduino IDE

About This Tutorial
This tutorial discusses what are libraries, how to install them and include them in Arduino IDE sketches.
Tutorial Info

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 the 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 to 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 it 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 the 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 to understand some steps, please reach out to us on our forum.

Share this Tutorial
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Related Projects & Tutorials
Smartphone Controlled Robot
Smartphone-Controlled Mobile Robot

In this project, you will learn how mobile robot works and how to make a robot which will be controlled using Smartphone via Bluetooth communication.

PictoBlox blocks Scratch how to
Getting Started with PictoBlox
PictoBlox is a programming software based on Scratch, where you can make interactive games, animations or program robots and projects with evive, Arduino, etc..
All articles loaded
No more articles to load
Featured Projects
All articles loaded
No more articles to load

Leave a Reply

Close Menu
×

Cart