Preface

This is a book about creating physical interaction with computer systems. It focuses on designing hardware and programming for systems that use either physical input or physical feedback. This book has been a dream of mine since I was an art student beginning to create interactive installations and finding that there was no simple introduction to the topics that I wanted to explore. At the time, I didn’t know what platforms, tools, and programming languages were available for creating interactive art, and I didn’t know where to find more information about these topics that a relative novice programmer could understand. As I began teaching, I was asked the same question again and again by students: “where do I begin?” Much has changed in the seven years since then, though, and now many excellent projects are helping beginners program, artists create, and programmers rapidly prototype applications. We’ll cover three of these projects in this book: Processing, Arduino, and openFrameworks. This book intends to answer the question “Where do I begin?” in as comprehensive a manner as possible. It is the intention of this book to be useful for almost any type of project. This book will provide technical advice, critical commentary for you to consider, code that you can use, hardware diagrams that you can use, and further resources for you to explore.

Ten years ago, the idea of artists or designers writing code or designing hardware was almost unheard of. Today, not only has it become commonplace, but it has become an important arena of expression and exploration. The dialogue between technology and design is a vital and vibrant one that shapes art and technology alike. I hope that this book can be, in some small way, another path into this conversation for more artists and designers.

Who This Book Is For

This book is aimed at designers, artists, amateur programmers, or anyone interested in working with physical interaction in computing. No assumption is made about your technical background or previous experience. The only assumption is that you are interested in learning to program and build hardware. This book is an introduction to a great number of topics, and throughout the book we list links to further resources so you can expand your knowledge or explore a particular topic that interests you. We encourage you to make as much use as possible of these resources and to use this book as a map for exploring a great number of technologies and techniques.

How This Book Is Organized

This book is broken into three parts. The first introduces the three projects that will be used throughout this book, the second introduces some of the most common themes in creating interaction in designs and applications, and the third introduces some of the more advanced topics that you may want to explore further. Also included with some of the chapters are interviews with programmers, artists, designers, and authors who work with the tools covered in this book. Covering such a massive range of topics means that this book doesn’t go into great depth about most of them, but it is filled with references to other books, websites, designers, and artists that you may find helpful or inspiring.

What Is—and Isn’t—in This Book

My excitement about the ideas and rapid growth of the field of interaction design is hard to contain. However, as exciting and far-reaching as interaction design is, the limitations of time and physical book size dictate that I be selective about what is and isn’t covered in this book.

What’s in

This book covers Processing, Arduino, and openFrameworks. To help novice programmers, it covers some of the core elements of programming in C and C++ for Arduino and openFrameworks and also covers the Processing language. We introduce dozens of libraries for openFrameworks and Processing—too many to list here. Some of these are official libraries or add-ons for the two frameworks, and some are simply extensions that have been created for this book or provided by altruistic coders.

We also introduce some of the basics of electronics and how computer hardware functions, as well as many tools and components that you can use with an Arduino. The Arduino and Processing IDEs are covered, as are two different IDEs for openFrameworks, namely, CodeBlocks, and Xcode. The Arduino Duemilanove and Mini are covered in depth, and we discuss other boards only briefly. We cover many electronic components that have designed expressly for the Arduino, called shields, in depth as well.

What’s Not in

While this book shows how to create some circuits, it doesn’t cover a great deal of the fundamentals of electronics or hardware, how to create circuits, or electronics theory. Chapter 18 lists some excellent tutorials and references. While the book does cover the Processing subset of the Java programming language, to conserve space and maintain focus, it doesn’t cover Java. The book doesn’t cover many aspects of C++, such as templates, inline functions, operator overloading, and abstract classes. Again, though, listed in Chapter 18 are several excellent resources that you can use to learn about these deeper topics in C++.

There are so many Arduino-compatible boards now that it’s almost impossible to cover them all in depth; the book mentions the Mega, the Nano, and several other boards only in passing and leaves out many of the Arduino-compatible boards that are not created by the Arduino team. Quite a few components and other tools that we would have liked to discuss in depth could not be included to maintain scope and to save space. A good camera for computer vision was not included either, though a glance at the openFrameworks or Processing forums will likely provide a more up-to-date discussion than could have been given here.

Many topics that we would have liked to include have been left out because of space considerations: artificial intelligence, data visualization, and algorithmic music, among others. Though these are all potentially interesting areas for artists and designers, the focus of the book is on teaching some of the theory and techniques for interaction design as well as the basics of hardware and programming. The resources listed at the end of the book can provide the names of some materials that might help you explore these topics.

Companion Website

All the code included in this book are available for download from the book’s companion website, http://www.oreilly.com/catalog/9780596154141.

Typographical Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, file extensions, path names, and directories.

Constant width

Indicates direct references to code, text output from executing scripts, XML tags, HTML tags, and the contents of files.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values.

Note

This icon signifies a tip, suggestion, or general note.

Warning

This icon indicates a warning or caution.

Hexadecimal numbers in this book are denoted with the prefix 0x.

Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Answering a question by citing this book and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: Programming Interactivity by Joshua Noble. Copyright 2009 Joshua Noble, 978-0-596-15414-1.

If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at .

Safari® Books Online

Note

When you see a Safari® Books Online icon on the cover of your favorite technology book, that means the book is available online through the O’Reilly Network Safari Bookshelf.

Safari offers a solution that’s better than e-books. It’s a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it for free at http://my.safaribooksonline.com.

We’d Like to Hear from You

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:

http://www.oreilly.com/catalog/9780596154141

To comment or ask technical questions about this book, send email to:

For more information about our books, conferences, Resource Centers, and the O’Reilly Network, see our website at:

http://www.oreilly.com

Acknowledgments

I need, first and foremost, to thank the wonderful engineers, artists, programmers, and dreamers who created the platforms that I’ve covered in this book. It is to all of them that I would like to dedicate this book. A woefully short list has to include Massimo Banzi, Tom Igoe, David Cuartielles, Gianluca Martino, David A. Mellis, Ben Fry, Casey Reas, Zach Lieberman, Theo Watson, Arturo Castro, and Chris O’Shea, the creators of the frameworks covered in this book. There are dozens, if not hundreds, of other names that should be on this list, but space is too limited to list them all. All I can say is thank to you to all the creators of these frameworks and to everyone who uses them to inspire, invent, amaze, and enrich the dialogue about design, technology, and art. This book is a humble attempt to thank you all for everything that you’ve given to me and to every other programmer, artist, or designer interested for working with computing in novel and interesting ways and bringing more people into the conversation. I would also like to extend my deepest thanks to all my interviewees for taking the time to respond to my questions and enrich this book and for so enriching the world of interaction design and art. To everyone who provided code for this book as well, created open source code, or answered questions on any of the forums for beginners, thank you for your efforts to create a community.

This book is as much my effort as it is the sum of the efforts of the editorial team that worked on it. My technical editors, Michael Margolis, Adam Parrish, and Jeremy Rotzstain, have been absolutely fantastic. Their expertise, suggestions, and fresh look at what I was working on shaped not only this book but enlightened me, showed me new ways of solving problems, introduced me to new tools and techniques, and sharpened my thinking and broadened my horizons for the better. This book is a collaboration between all four of us in every sense of the word. I cannot pay them enough thanks for their excellent work. I would also like to thank Justin Hunyh and Mike Gionfriddo from LiquidWare as well as Nathan Seidle from Sparkfun for all of their help. My editors, Robyn Thomas and Kim Wimpsett, have been incredible, helping me with my sometime torturous grammar and patiently working with my propensity for sending in extremely rough drafts to bounce ideas off of them. They have made this book better than it ever could have been without their watchful eyes and guidance. Finally, I need to thank Steve Weiss for listening to my idea when I first proposed it and helping guide it through to completion.

I need to thank all of my friends in New York, Amsterdam, Geneva, London, Zurich, Boston, Paris, and Toulouse for their support, their ideas, their Internet, and their encouragement. I would like to thank my family as well, and particularly my mother, for their support and humor.

Get Programming Interactivity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.