How to Install Libraries written for the Arduino IDE
Arduino library is just a group of functions that are packaged together that are similar. They are a collection of codes that extend a programming language. Libraries make it easy for programmable devices such as microcontrollers, SoCs, etc., to communicate with sensors, displays, modules, etc. Some of them, such as the SoftwareSerial library, are packaged with the IDE and are ready to be used right after the install process. Others, however, are available on the internet for download and need to be incorporated into the Arduino IDE.
Installing Libraries from the IDE
This is the easiest way to install a library. The Arduino IDE includes a menu option to manage the install process of libraries. This option can be found under
Sketch → Include Library → Manage Libraries…
Once you select this menu option, you will find a long list of libraries that can be installed using a single click process. Use the search field for entering a portion of the name of the library for which you’re looking. Below we show an example where we find ESP8266 Library.
After clicking the Install button the IDE installs the library and makes it available for use in our programs.
Installing Libraries from the IDE (.zip)
Although libraries for most of the standard electronic components and devices can be found through the Board Manager, there are instances where we want/need to install a specific library without using such process. In this case, we need to obtain the code ensuring it is structured in an Arduino IDE-compatible way. If you’re searching the web for “Arduino libraries” chances are that the developer already structured the code so that it can be used in the Arduino IDE, however, if problems occur you’ll need to look at working examples to try and figure out what’s wrong. Contacting the developer directly is also a viable option for troubleshooting.
The most popular place for hosting software these days is on Github. We can obtain the code from this site by clicking on the Download ZIP button on the library’s page. If you’re downloading a library from any other site, you’ll need to make sure that it is compressed into a .zip file.
Once downloaded, we can use the Library Manager on the Arduino IDE to install the library. After selecting the menu option
Sketch → Include Library → Add .ZIP Library…
We locate the downloaded file in our system and click on install. After doing this, the library is ready for use in our programs.
Installing Libraries Manually
No matter the approach we follow the way in which the Arduino IDE manages software libraries is by creating a copy of the files in the Operating System. Typically, the IDE does this inside the Arduino/libraries directory. Both on Windows and Mac OS the Arduino directory is located inside the user’s Documents directory.
For manually installing a library, we need to move the uncompressed directory to the aforementioned libraries directory!
Removing Libraries from the Arduino IDE
As mentioned in the previous step, the Arduino IDE creates a copy of the library files in a specific directory of the Operating System. We simply need to delete these files in order to remove the library from the IDE. The location of the files is inside the libraries directory contained in the Arduino folder, which by default (both on Windows and Mac OS) is inside the user’s Documents directory.
Using A Newly Installed Library
The first thing we do after installing a library following any of the three methods above is to open the examples included by the library’s developer(s) to showcase the use/functioning of the software. As with the built-in examples, they’re available through
File → Examples → Library Name → File Name.
Latest posts by sarah ali (see all)
- Maximum Allowed Google AdSense Ads on your WordPress Blog - January 19, 2018
- How to Get Started with Google AMP in WordPress - January 18, 2018
- 5 Best Backup Plugins for WordPress 2018 - January 14, 2018