O'Reilly logo

Arduino Sketches: Tools and Techniques for Programming Wizardry by James A. Langbridge

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

CHAPTER26

Creating Your Own Library

This chapter discusses how to create your own library. You can find the code downloads for this chapter at http://www.wiley.com/go/arduinosketches on the Download Code tab. The code is in the Chapter 26 download and individually named according to the filenames noted throughout this chapter.

The Arduino project has had an immense success since its creation, and there are several reasons. The cost is, of course, an important criterion to any project. Continuous R & D has also helped, but one of the primary reasons today is simple: the openness of the project. The Arduino community is extremely active. Just look at the Arduino forums: Google+ groups or Arduino events organized in cities throughout the world. This is the community that drives the ongoing evolution of the platform, either by getting the tools to work with new electronic components and breakout boards, or finding and creating their own when nothing exists. In Chapter 25 you created your own shield, now you will create your own library.

Libraries

You can use libraries for several applications, but two main uses exist. One is to have specific routines such as temperature conversion, data processing, or hardware I/O. The second use is to allow the use of specific hardware, hiding away any long routines, and making hardware easy to use. This chapter looks at both of these kinds of libraries.

Library Basics

When you import a library, you import an .h file, the header file. This is a text ...

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