How to Install Arduino Libraries?

 You install Arduino libraries in three main ways:

  1. 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

  1. Open the Arduino IDE.

  2. Go to:

    • IDE 2.x: Sketch → Include Library → Manage Libraries…

    • IDE 1.8.x: Sketch → Include Library → Manage Libraries…

  3. In the Library Manager window, type the library name into the search box
    (e.g. “Adafruit NeoPixel”, “AccelStepper”, “Servo”).

  4. Click the library you want, then click Install.

  5. Wait until it shows INSTALLED.

How to use it after installing

  • In your sketch, add:

    #include <LibraryName.h>
  • Or go to Sketch → Include Library and select it from the list; the IDE will add the #include line for you.


2. Install from ZIP file

Sometimes authors give you a .zip instead of publishing to Library Manager (e.g. GitHub repos).

  1. Download the .zip file of the library to your computer.

  2. In the Arduino IDE, go to:
    Sketch → Include Library → Add .ZIP Library…

  3. Select the downloaded .zip file and click Open.

  4. The IDE will copy it into your libraries folder 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 an examples folder.

  • The folder name = library name (no -master, no weird characters if possible).

Example structure:

MyLibrary/ library.properties src/ MyLibrary.h MyLibrary.cpp examples/ Example1/ Example1.ino

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.

  1. Create a libraries folder if it doesn’t exist.

  2. Copy the MyLibrary folder into libraries/.

  3. 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 Library and look under “Contributed libraries”.

  • Or open: File → Examples and 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 directory for #include <Something.h>

check:

  1. The header file name matches exactly (case-sensitive on some systems).

  2. The library folder is in the correct libraries path.

  3. You restarted the IDE after manual install.


5. Updating or removing libraries

Update via Library Manager

  1. Open: Sketch → Include Library → Manage Libraries…

  2. If a newer version exists, you’ll see an Update button.

Remove manually

  • Close the IDE.

  • Go to your libraries folder.

  • Delete or rename the library’s folder.

  • Re-open the IDE.


6. Quick checklist

  • Use Library Manager whenever possible.

  • For .zip files, use “Add .ZIP Library…”.

  • For GitHub or manual folders, put them into …/Arduino/libraries/ and restart the IDE.

  • Always double-check the #include name and capitalization.


评论

此博客中的热门博文

Detailed Explanation of STM32 HAL Library Clock System

How To Connect Stm32 To PC?

How to add a GPS sensor to ESP32 for Wokwi?