How to add library in arduino?

Arduino Libraries

Libraries are files written in C or C++ (.c, .cpp) which provide your sketches with extra functionality (e.g. the ability to control an LED matrix, or read an encoder, GSM, GPS, NRF24L01 etc.). Arduino software is kept flexible users can create there own library or add libraries for new devices.

Adding Library to Arduino

Step 1: Download your library zip file example Keypad.

Step 2: Unzip your library file. You will find files “Keypad.cpp”, “Keypad.h” and folder “examples” in a library name folder in our case Keypad. These three are essential parts of any library.

Note that library folder name should not start with numbers and space is not allowed in library folder name. 

Step 3: Find your Arduino Installation Location. By right clicking  on arduino shortcut icon. Click on Properties.

Find location of arduino installation
Find location of arduino installation

Step 4: You will see this screen and Click on Find Target

Find Installation Location
Find Installation Location

Step 5: Locate “libraries” folder and open it

Library Folder
Library Folder

Step 6: Copy and paste your library in this folder in our example it is “Keypad

Library folder
Library folder

Check that you have these files in example library “Keypad” folder

Inside keypad folder
Inside keypad folder

Step 7: Close Arduino IDE and reopen it to see the added library in Examples>>Keypad

Arduino Screen After Adding Library
Arduino Screen After Adding Library

Step 8: To use library you need to add it in your code using include command.
Example:
#include <Keypad.h>

To see the demo of keypad interfacing visit Matrix Keypad interfacing with Arduino

This way you can add libraries in arduino.

Leave a Reply