Chapter 7. Arduino Libraries

The Arduino IDE comes with a collection of libraries that can be used with program sketches. These contain functions to access peripheral devices like an Ethernet interface, a liquid crystal display, a conventional serial interface, and many others.

Note that although the term “library” is used to describe auxiliary code, the modules themselves aren’t always what one might think of as a library in the sense of a precompiled module, such as the .a (archive) or .so (shared object) libraries in Unix or Linux. In many cases they’re just standard C or C++ source files (with AVR-GCC limitations, of course), but the end result is largely the same. Library code is compiled as necessary along with the sketch code into object files and linked with the sketch (see Chapters 5 and 6). In other cases a library really is a binary object, such as the components supplied with the avr-libc library suite. If you want to know where a library or external code module is coming from, check both the avr-libc documentation and the Arduino documentation.

After a program sketch and any library modules are compiled, the linker utility resolves the address references between the library components and the user-supplied functions, and then binds all the components into one executable binary image. The AVRDUDE utility employed by the IDE (discussed in Chapter 6) handles the process of interacting with the on-board bootloader (covered in Chapter 5) to transfer the compiled binary ...

Get Arduino: A Technical Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.