Using Arduino library in eclipse

Overview

This tutorial will show you how to use Arduino library in eclipse for Arduino. When you have finished reading this tutorial, you will be familiar with:

  • Adding a library using the Library Manager
  • Adding a library from the library folder

What You Will Need

We will need the following for this tutorial:

  • Eclipse Arduino IDE (Sloeber)

If you haven’t setup Eclipse please refer to my previous tutorial on eclipse for Arduino..

Adding the Arduino library

Start eclipse by clicking on the shortcut you created in the previous tutorial.

Library Manager

When eclipse has fully started go to Arduino ->Preferences and click on Library manager. In the library manager browse for the desired library (e.g. expand Display and look for Liquid Crystal I2C) and check it and click OK. This will install your library into the library folder.

Adding library through the library Folder

The Eclipse for Arduino library has a standard folder structure and for your library to work you must comply with this folder structure. I.e.

 

To add a library manually go to your extract folder and open arduinoPlugin then libraries. Inside this folder create a new folder and rename it your library name. Inside this new folder create another folder and rename it to the version of your library. Extract your library into the version folder and clean it up to look like the folder structure above. Now you should be able to use your new library under Arduino -> Add library to selected project

Using the Library

To use your library, select your project and then go to Arduino -> Add library to selected project. Look for your library name, check it and click Ok. Your library will now appear under libraries in your project structure. However to use it, you have to add a reference in your sketch (Blink.ino) i.e.

Learn More

For further reading please refer to the following links: