How to Install Arduino Libraries?
You install Arduino libraries in three main ways:
-
via Library Manager, 2) by adding a ZIP, or 3) manually copying a folder. I’ll walk you through all three.
1. Install via Library Manager (easiest & recommended)
Works for: Arduino IDE 1.8.x and 2.x
-
Open the Arduino IDE.
-
Go to:
-
IDE 2.x:
Sketch → Include Library → Manage Libraries… -
IDE 1.8.x:
Sketch → Include Library → Manage Libraries…
-
-
In the Library Manager window, type the library name into the search box
(e.g. “Adafruit NeoPixel”, “AccelStepper”, “Servo”). -
Click the library you want, then click Install.
-
Wait until it shows INSTALLED.
How to use it after installing
-
In your sketch, add:
-
Or go to
Sketch → Include Libraryand select it from the list; the IDE will add the#includeline for you.
2. Install from ZIP file
Sometimes authors give you a .zip instead of publishing to Library Manager (e.g. GitHub repos).
-
Download the
.zipfile of the library to your computer. -
In the Arduino IDE, go to:
Sketch → Include Library → Add .ZIP Library… -
Select the downloaded
.zipfile and click Open. -
The IDE will copy it into your
librariesfolder automatically.
You should now see the library listed under Sketch → Include Library and in File → Examples (many libraries install example sketches).
3. Manual installation (copy the folder yourself)
Useful when:
-
A library is not packaged as a proper Arduino ZIP.
-
You cloned a Git repo directly.
Step A – Find the right folder
The library folder should look like this:
-
Contains files like
library.properties,.h/.cpp, maybe anexamplesfolder. -
The folder name = library name (no
-master, no weird characters if possible).
Example structure:
Step B – Copy into the libraries directory
Where is the libraries folder?
-
Typically inside your sketchbook folder:
-
Windows:
Documents/Arduino/libraries -
macOS:
~/Documents/Arduino/libraries -
Linux:
~/Arduino/libraries
-
You can confirm or change your sketchbook location in
File → Preferences → Sketchbook location.
-
Create a
librariesfolder if it doesn’t exist. -
Copy the
MyLibraryfolder intolibraries/. -
Restart the Arduino IDE so it picks up the new library.
Now it should appear in:
-
Sketch → Include Library -
File → Examples → MyLibrary
4. Checking if the library is installed correctly
-
Go to
Sketch → Include Libraryand look under “Contributed libraries”. -
Or open:
File → Examplesand look for the library’s name – if it has examples, they’ll appear there.
If you try to compile and see:
No such file or directoryfor#include <Something.h>
check:
-
The header file name matches exactly (case-sensitive on some systems).
-
The library folder is in the correct
librariespath. -
You restarted the IDE after manual install.
5. Updating or removing libraries
Update via Library Manager
-
Open:
Sketch → Include Library → Manage Libraries… -
If a newer version exists, you’ll see an Update button.
Remove manually
-
Close the IDE.
-
Go to your
librariesfolder. -
Delete or rename the library’s folder.
-
Re-open the IDE.
6. Quick checklist
-
Use Library Manager whenever possible.
-
For
.zipfiles, use “Add .ZIP Library…”. -
For GitHub or manual folders, put them into
…/Arduino/libraries/and restart the IDE. -
Always double-check the
#includename and capitalization.
评论
发表评论