Home

Libraries Q&A

What is an Arduino library?

Short answer: Libraries provide extra functionality for use in sketches, e.g., working with hardware or manipulating data.

Arduino.cc answer. 

Where do you install libraries?

The generic answer you may often see is '..\Arduino\libraries'.

Example: On my PC, they are installed at 'C:\USERS\DPREFONT\MY DOCUMENTS\ARDUINO\libraries'

Are mods needed to install a library? Usually, yes. If you downloaded the library as a .zip file from github, example https://github.com/adafruit/Adafruit-RGB-LCD-Shield-Library, the result is 'Adafruit-RGB-LCD-Shield-Library-master.zip'. When you expand/unzip the archive, the result will be 'Adafruit-RGB-LCD-Shield-Library-master'. Usually the owner`s website will recommend you remove the 'master' or 'library' portion of the extracted folder name, so in this case the final folder name should be 'Adafruit-RGB-LCD-Shield'.

If you install a library and then reference it in your sketch ( e.g., '#include <Adafruit_RGBLCDShield.h>') but AVRDude reports being unable to find the library during compiling, it's probably because 1) the library is not in the expected location, 2) the folder name has changed from its original name, 3) you changed the case of the folder name (i.e. dht library is different from DHT library), or 4) the folder name should have used underscore characters instead of dash characters (this can occur if using an older Arduino IDE version).

Is there more than one library folder? Yes, there is your library folder mentioned above as well as 'C:\Program Files (x86)\Arduino\libraries'; this is not an area you want to play around in as it contains the default libraries found in the IDE menu under 'Sketch|Include Library'.

Any libraries you add should always go into '..\Arduino\libraries'. If you fail to follow this advice and mess around in 'Arduino15' (mentioned below) as well, you may end up having to uninstall your IDE and delete these folders before you reinstall the IDE. I have had misbehaving libraries force me into just that situation. I say the library was at fault but it could have simply been a bad IDE release; doesn`t matter - same crappy net result.

Are any other IDE areas off limits? Yes, 'C:\Users\dprefont\AppData\Local\Arduino15'. When you need to add a new Arduino board from Arduino or other vendors, you will add it under the menu path 'File|Preferences|Additional Boards Manager URLs:' The index to the new board will be stored in this folder as well as the 'preferences.txt' file itself. FYI: do NOT have the Arduino IDE open if you choose to modify something in the 'preferences.txt' file like `last.sketch0.location` or whatever.
Is there a Library installation procedure? Click here. It's a full size .gif so it will take a few seconds to load.
How do I write my own library? Arduino.cc answer.