☝️Do not unzip the downloaded library, leave it as is. In the Arduino IDE, navigate to Sketch Include Library Add.ZIP Library. At the top of the drop down list, select the option to 'Add.ZIP Library'. Return to the Sketch Include Library menu. You should now see the library at the bottom of the drop-down menu. Arduino checks the library directory at startup so if you already have Arduino open, you will need to restart Arduino any time you add to the libraries directory. If you don’t see the CapacitiveSensor example try closing and re-opening Arduino IDE. Step 1: Open Arduino IDE, click Sketch - Include Library - Add.ZIP Library. Step 2: Find Sensor Kit V2.0 for Arduino Library LiquidCrystalI2C, click Open. Step 3: When you see the highlighted message below, it means you have added the library successfully. Please use the same method to add other libraries then. When it comes to adding a keypad to Arduino, the first thing you will have to do is install the keypad library; you can either use Alexander Brevig or Mark Stanley. The library is vital since it takes care of setting up your pins as well as polling different rows and columns.
You want to do a cool project with Arduino and sensors. But you need an external library to install in Arduino. Either you don’t know how to install it or you know but you are getting error every time you try to add or even after adding library, it is showing there is no library. It is little frustrating as you are not doing anything with project but stuck in between libraries. And trying to figuring out why you are not able to add library and even after adding library, error is showing or code is not compiling. We will look 4 ways to add library in Arduino without getting error and also discuss some common error you will get while compiling with libraries. The method I am showing will solve your problem. So let’s get started.
Downloading Library:
You can download libraries from Github. Type sensor name and at the end type Github, you will get sensor library, download it. It will be in zip file.
How to check library is installed:
Go to File > Example > (You can see list here)
Method 1 (Easiest): ADD .zip Library
Open Arduino IDE. Go to Sketches > include library > Add .zip Library > select file location > click open.
Your Library is added successfully.
Method 2 : Manage Libraries
Open Arduino IDE. Go to Sketches > include library > Manage Libraries > Type library name > install
Type the name of library and click install. Drawback is only popular libraries can be found by this method.
Method 3 (Manually): Copy Paste library to Arduino Directory
First we need to unzip our zip library. Copy the unzip library folder.
And go to C:Program Files (x86)Arduinolibraries paste that folder in libraries.
If your Arduino IDE was opened at that time and close it. And Again restart Arduino IDE. So it will include that library.
Method 4 (Manually): Renaming & Deleting files.
You did everything but still library is not showing up and getting errors.
Sometimes downloading library from internet, zip file name is with something master or any other name. Causes problem when when we install the library.
I am giving here one example with DHT library. You can download and try this exercise.
You can try to add DHT library with method 1 (Add .zip Library) and method 3 (Copy Paste library to Arduino Directory). It will show library is added but when you try to compile code it will show error. Here we are going to solve this issue.
change “DHT-sensor-library-master” library folder name to only “DHT” (I am talking about only for this example you can change name according to your library name) in arduino libraries , C:Program Files (x86)Arduinolibraries
Also make sure folder name and file .h & .cpp file name is same. If require delete other .h & .cpp file in that folder, only keep DHT.h & DHT.cpp file with examples.
Restart the Arduino IDE. Now you can see it is complied successfully.
Add Libraries To Arduino Ide
Common Error with Libraries and Compiling in Arduino:
Add Library To Arduino
- Make sure spelling is correct in code as well as file in Arduino libraries. look for upper case and lower case as it is case sensitive.
- Go to Tools > Board:Make sure Board is Arduino Uno or Nano whatever you are using. Because it is compiling code for that board. For example if I am trying to compile code of Mouse for Arduino Uno or Nano. It won’t compile because it is meant for Leonardo and Due boards only.
3. Go to Tools > Port select correct port.
These are the most common things which causes error while compiling and Now you know how to solve it.
How To Add Libraries To Arduino From Github
Till then keep learning keep making.