Installing an Arduino Library

| 0 comments

Two months ago I published a DCF77 library for the Arduino and many questions I got about it are about how to get the library compiling together with the other libraries needs.

Contributed Libraries

There is no centralized system for downloading and installing libraries, which would make the life of a casual Arduino user a lot easier. The best starting points for finding a library that are http://www.arduino.cc/en/Reference/Libraries and http://arduino.cc/playground/Main/LibraryList. Follow the links and you will (usually) find a link to library download. In the latter list your can find the DCF77 library, pointing to the article in the Arduino playground, which in turn links to the download page here.

DCF77DownloadLocation 1024x913 Installing an Arduino Library image

DCF77 library download location

If you open the .zip or .rar file you will notice that this package not only contains the DCF77 library, but also the Time and TimeZone libraries. You could directly get the latest version of the DCF77 from GitHub, but then you do need to fetch and install the Time and TimeZone libraries by hand.

rarfileDCF77library 300x203 Installing an Arduino Library image

Rar or zipfile DCF77 library

Now, let’s save the the libraries to the right location. First, open your Arduino sketchbook folder. If you do not now where this is, look in the configuration panel of the Arduino IDE.

preferencesArduinoIDE Installing an Arduino Library image

Preferences Arduino IDE

preferencesSketchbookLocation Installing an Arduino Library image

Sketchbook location in Preferences screen

If there already is a folder called libraries in the sketchbook folder, place the DCF77, Time and TimeZone folders in there. If not, create the folder called libraries, and then copy the libraries.

LibrariesFolder Installing an Arduino Library image

Location Libraries Folder

LibrariesInstalled Installing an Arduino Library image

Libraries installed in folder

Running the examples

After installing the libraries, we need to restart the Arduino IDE in order for it to see the new libraries and examples. If the libraries placed at the correct location, they should now turn up in the “Sketchbook” menu item.

ExampleFromSketchbook Installing an Arduino Library image

Loading Sketchbook example

As well as in the “Examples” menu item.

ExampleFromExamples Installing an Arduino Library image

Loading example from Examples

You can now also easily add libraries in your own sketch. Selecting the libraries through the menu item “Import Library” results in the library being included in source code of your sketch.

ImportLibrary Installing an Arduino Library image

Import library in sketch

LibrariesIncluded Installing an Arduino Library image

Libraries included in sketch

Leave a Reply

Required fields are marked *.