Installing an Arduino Library
Manually Installing a Library - Windows
This section covers manually installing a library under the Windows environment and utilizes quite a few screen shots. If you’re more of a text learner then check out the Arduino tutorial on installing libraries.
We are going to use the Capacitive Sense library for this example. Navigate to the library’s page and download the zip file.
Find the zip file on your local computer (wherever downloaded files end up). Under Windows, you should be able to double click on the file to open it up.
This particular library contains libraries for both the basic Arduino and the more advanced Arduino Due. You can use both if you’d like, but, for this example, we will be copying and installing only the CapacitiveSensor folder.
Libraries will usually contain a *.cpp file and .h file. Most will also contain an examples folder.
Under Windows, Arduino stores all the add-on libraries within the My Documents folder. Here we see the location of the Arduino libraries folder.
Open an explorer window and navigate to the libraries folder under My Documents. Now copy the new CapacitiveSensor folder to the libraries folder.
To verify the library has been installed correctly, open up the Examples folder under the Arduino IDE. Wait. Where’s the CapacitiveSensor example? Did you have Arduino open when you copied and pasted the directory? 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.
There it is! Let’s open the example provided with our new library.
Examples are the greatest thing about libraries! Good libraries will have well written examples showing how to use the library. These sketches are wonderful resources for example code and learning how to write good code under Arduino.
You now have the Capacitive Sensor library installed! Feel free to start from the example sketch, or begin writing your own code using the functions provided by the library. A library usually has documentation either on its site or written into readme files and example code. In general, to quickly learn how to use a library check out the example code.