Installing Arduino libraries!!

Installing Arduino libraries!!

Once you are comfortable with the Arduino basics and trying to work with some sensors but can’t figure how to make them work ’cause they work in complex ways which is beyond your scope and you just want simple output data without having to learn how they actually work in depth!!! Well, in Arduino, you need additional libraries for that!

What are Libraries and why you need them?

Libraries are like a collection of code which makes it easy for you to connect or drive a sensor, module, display etc. For example, the built-in LiquidCrystal library makes it really simple to talk to character LCD displays. But not all the modules/sensors have builtin libraries instead the manufacturers provide them with their products. To use the additional libraries, you will need to install them.

Using the libraries can make your life so much easier! Remember the post about Distance Measuring with Sonar Sensor with lines of codes??
Well, with the help of NewPing library, you could do that in just a single line!!!

Serial.println( sonar.ping_cm() );

Installing Library from .zip file

  1. First download the library .zip file (ie: we’ll use the NewPing as example)
  2. Open your Arduino Ide and from the menubar go to
    Sktech-> Include Library-> Add .ZIP Library…“.rsz_add library
  3. Browse and select the .zip file you downloaded.
  4. Close the arduino IDE and reopen.
  5. You should be able to find your library in the example(if it includes).
  6.  Now you are good to include them in your sketches!!
    #include <NewPing.h>  //includes the NewPing Library

    follow the instructions on using the constructors and methods of the library you downloaded from the source page.

Trouble Shooting

t1rsz_573f96d7b5a4cIf you are having an error like this, its probably because the library files have been zipped multiple times and you need to extract them and put in your library folder manually.

See this section on the arduino forum for details.

Feel free to comment if you face trouble following any part of this tutorial or need additional help!

Thank You!

What are your thoughts?