Installing libraries on Arduino is simple to comprehend but before getting into it, we have to understand what libraries are? There are different functions that help us in sketches of Arduino in writing the codes for different projects.
There are two types of libraries; one is standard which are included in Arduino IDE and provided by Arduino itself and the other libraries can be imported from other sources, for example from Arduino’s official website. These libraries can help us in interfacing with various components. For example, the liquid crystal is a standard library that helps us in using the LCDs, and another example is of capacitivesensor library that helps us with capacitive sensing.
The installation of the libraries on Arduino is not hard to crack. In this write-up, we have discussed the methods of installing the libraries on Arduino.
How to install libraries on Arduino
There are three different ways of installing the libraries on Arduino:
We will discuss all these methods of installing libraries on Arduino in detail.
Through library manager
We can install libraries through its library manager, for example, we will install the liquid crystal library which is used for communicating with LCD by the following steps:
Click the “Sketch” on the menu bar of Arduino IDE, a dropdown menu will appear to go to the “Include Library”, in the newly open dropdown menu, choose “Manage Libraries…”:
The other way of opening the “Manage Libraries…” is using the shortcut key “Ctrl+Shift+I”, now in the Library Manager, we will type the name of the library in the search bar to find it, for example, we will type liquid crystal:
Adafruit LiquidCrystal is the most appropriate result, will click on it, choose the version of the library (in some cases only one version is available), and click on the Install button:
The status of the installation can be seen on the output:
By importing a zip library
We can also install the library by importing its zip file into Arduino IDE from the computer, for example, we already downloaded a zip file of the LiquidCrystal library on the computer, we will just import it by the following steps:
Again click on the “Sketch” in the menu bar of Arduino IDE, then go to “Include Library” and click on the “Add .ZIP Library…”:
Choose the location where the zip file is located and click on the “Open” button:
It will install the library Automatically and when it is installed, a notification will appears on output pane:
Manual installation of the library
For the manual installation of the libraries, we should know the location of a sketchbook, to know this, go to the “File” and then click on the “Preference”:
In the “Preferences”, the location of the sketchbook is visible, note it and close the menu. The location of the sketchbook can be changed from here if you want to do so.
Go to the folder, where you have downloaded the zip file of the library:
We are going to install the “CapacitiveSensor” library, so we will extract the downloaded zip of file:
Copy the extracted “CapacitiveSensor-0.5.1” folder and paste in the “libraries” of the sketchbook “This PC > Documents > Arduino > libraries”:
Now to verify that the library is included in the sketchbook, go to the “Sketch” in the menu bar of Arduino-IDE:
So the library was added to the Arduino IDE manually successfully.
Conclusion
Libraries contain the functions and examples which can help the user to write codes for different projects. For example, as discussed in the article above, to communicate with LCD, we have to install the library of the “LiquidCrystal”. In this write-up, we have discussed different methods to install the libraries on Arduino with the demonstration of installing different libraries as an example.