Arduino: install Arduino IDE library

Every time I introduce the implementation of each device, sometimes I have to install the library, which is always troublesome. I am worried that people who read the blog will not install the Arduino library. Due to the length, I can only introduce a little bit. This article introduces three methods of installing the library in detail, so that friends who read the blog can refer to this article to easily install the library.

The library is a set of codes, composed of C language programs .C or .CPP and title files .H and other files, allowing users to easily connect to sensors, displays, and sensing modules. For example, the built-in LiquidCrystal library can easily communicate with LCD displays. There are hundreds of additional libraries available for download on the Internet, and different libraries can be installed on different devices.

Installation method 1: Use the management library

To install a new library in the Arduino IDE, you can use [Manage Libraries] to complete. From the drop-down menu [Sketch draft code]> [Include Library]> [Manage Libraries], double-click [Manage Libraries] to execute.


After execution, the following screen will appear: You can enter the name of the library you want to query at the top. If the library has been installed, the word [INSTALLED] will appear after its name.


To install the library, select the version on the right and click [Install] to download and install. After completion, a "INSTALLED" will appear next to it to indicate completion, and you can close the [Management Library].

Installation method 2: Import .zip library

Libraries are usually released in the form of ZIP compression, especially the files on Github, which are downloaded as ZIP files. Usually the file name of the compressed file is the name of the library. After opening the compressed file, there are text files of .cpp or .h, sample programs of the library, and other files of the library. Starting from version 1.0.5 of the Arduino IDE, third-party libraries can be installed in the IDE. You don't need to unzip the downloaded library to use it.

In the Arduino IDE, drop down the menu [Sketch draft code]> [Include Library]> [Add .ZIP Library]. A window for selecting a file appears. After selecting the name of the compressed file to be imported, press [Open] to add to the library and you are done.

After the import is successful, the following message will appear:


Return to the main menu, select [Sketch Draft Code]> [Include Library Import Library] menu, you can see the library name under the drop-down menu. IDE has decompressed the compressed ZIP file and saved it under the default library path. As for the location of the default path, please see the instructions for installation method three.

Installation method 3: Manual installation

If you want to add the library manually, you need to download the ZIP file, expand it manually, and place it in the correct directory. The content of the ZIP file contains all the required content, including program examples provided by the author, etc. As mentioned in the previous chapter, in some cases, you need to perform the installation manually and put the library into the libraries folder specified by the IDE.

You can see the path where the library is stored in [File]> [Preferences]> [Sketchbook location]. You can open this directory first, and then copy the unzipped library directory to Under this path.

Open the downloaded library ZIP file directory, unzip the ZIP file into a temporary folder, and then select the entire folder with the library name and copy it to [libraries] under the location path of the Sketchbook location draft codebook Folder.

Restart the Arduino IDE and select the drop-down menu [Sketch Draft Code]> [Include Library]. Check whether the name of the library you just copied is already in the list.

Need attention

The Arduino library will be managed in three different locations:
  • The directory when the IDE program is installed
  • Core folder
  • Sketchbook location The directory of the draft codebook
When compiling, if the above directories have the same library name, the library under the directory of the draft codebook will be taken as the latest version, overwriting the other two libraries with the same name.

When selecting a specific core library for the circuit board, the library in the core folder will be used as the priority.

When the Arduino IDE is upgraded, you can delete the Programs / Arduino directory. At this time, the library in the sketchbook path will not be deleted. Just download and install the Arduino IDE program again. After completion, specify the path of the sketchbook to the original path, that is You can use the library that was originally downloaded and installed.

[Reference]


Post a Comment

Previous Post Next Post