Installing Libraries in Arduino IDE
While going through various tutorials, you may be asked to install additional libraries for the code to work. A library is a group of related code with a common purpose, such as connecting and reading values from a sensor. There are various methods of installing libraries, which are discussed in detail in this tutorial
Installing Libraries using Library Manager
Step – 1: Open Arduino IDE. Go to Sketch menu and then Include Library > Manage Libraries
Step – 2: A list of already installed libraries will show up. We will be installing ArduinoJson library. Search for arduinojson, choose the version you want to install, and then click install. That’s it, you are done.
Importing a .zip Library
Step – 1: Sometimes library is provided as a zip folder, containing an examples folder, .cpp files, .h files and other such files required by the library. Download the zip folder, which is usually provided through github. Don’t unzip it, leave it as it is.
Step – 2: Go to Sketch menu and then Include Library > Add .ZIP Library. Select the library you want to import.
Step – 3: If you get an error while adding the zip library, then you need to delete the .github folder inside the library. You need to extract the library, delete the github folder, and compress it again.
Step – 4: Verify that the library is installed by going to File > Examples
Manually Install Library
Step – 1: Download the .zip library you want to install as mentioned earlier, but this time extract it and put it in the directory named same as the library name.
Step – 2: Place the library inside the libraries folder of your sketchbook. You can find the sketchbook location inside File > Preferences
Step – 3: Reopen the Arduino IDE, and verify that the library is installed by going to File > Examples