Libraries are a collection of code that provide extra functionality for use in sketches, for example when working with hardware or manipulating data.
Learn how to add libraries to Arduino IDE.
Using the Library manager
-
Open the Library Manager:
- In the menu bar, select Tools > Manage Libraries…
- In IDE 2, you can also click on the button in the sidebar.
-
Filter the available libraries by typing something (such as a library name) in the text field above the listed libraries.
IDE 1.x also has options to filter by Type and Topic.
-
Find the library in the search results. The results are listed alphabetically, so you may need to scroll down the list.
To find more information about the library, click More info. This will usually take you to a reference page or repository for the library
-
Find a library you want to install. You can review the description and author. When you’ve found a library you want to install, click Install. The latest version is selected by default.
The Library Manager looks slightly different depending on what version of the IDE you are using.
-
Wait for the installation to complete.
To find more information about the library, click More info. This will usually take you to a reference page or repository for the library
Importing a .zip Library
-
In the menu bar, go to
Sketch > Include Library > Add .ZIP Library...
-
You will be prompted to select the library you want to add. Navigate to the .zip file’s location and open it.
-
If you’re using Arduino IDE 2, you may need to restart it for the library to be available[1].
Manual installation
-
Go to the directory where you have downloaded the .zip library file.
-
Extract the .zip file.
-
Select the main folder (it should have the library’s name) and move it to the “libraries” folder inside your sketchbook.
-
Restart Arduino IDE.
Note that adding a library to the “libraries” folder in the sketchbook will override other previously installed library versions.
Using installed libraries
When the library has been installed you can do the following:
- Open any included example sketches from File > Examples > <Library Name> in the top menu bar. Note that all libraries do not come with examples.
- Include the library in your sketch by selecting Sketch > Include Library > <Library Name>.
Further reading
-
Installing libraries in the Arduino IDE 1 on Arduino Docs
-
Installing libraries in the Arduino IDE 2 on Arduino Docs
-
About #include