O'Reilly logo

Beginning Arduino Programming by Brian Evans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Libraries

To use a library in an Arduino sketch, we need to tell the compiler which library we want to use. There are two ways to do this. The first is to use a #include pre-processor directive at the beginning of our sketch to specify the library’s file name, as follows:

#include <LibraryName.h>

LibraryName.h is the file name of the library that we want to use. In our last project example, we used the line #include <LiquidCrystal.h> to enable those functions that make it easier to use an LCD with our project. Pre-processor directives are instructions to the compiler that tell it to include the functions that we want to use at the time of compiling. They don’t follow the normal syntax of statements and don’t end with semicolons. We mention ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required