Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Programming Interactivity
Preface
Who This Book Is For
How This Book Is Organized
What Is—and Isn’t—in This Book
What’s in
What’s Not in
Companion Website
Typographical Conventions Used in This Book
Using Code Examples
Safari® Books Online
We’d Like to Hear from You
Acknowledgments
I. Introductions
1. Introducing Interaction Design
What This Book Is for
Programming for Interactivity
The Nature of Interaction
Messages and Interaction
Interfaces and Interaction
Languages of Interaction
Design and Interaction
Art and Interaction
Data Exchange and Exploration
Working Process
2. Programming Basics
Why You’ll Read This Chapter More Than Once
The Nature of Code
Variables
Simple Types
int
Signed versus unsigned
float
char
bool or boolean
string
byte
long
Arrays
Casting
Operators
Control Statements
if/then
for Loop
while Loop
continue
break
Functions
Defining a Function
Passing Parameters to a Method
Some Suggestions on Writing Functions
Overloading Functions
Objects and Properties
Scope
Review
3. Processing
Downloading and Installing Processing
Exploring the Processing IDE
The Basics of a Processing Application
The setup() Method
The size() method
The frameRate() method
The print() method
The draw() Method
The Basics of Drawing with Processing
The rect(), ellipse(), and line() Methods
RGB Versus Hexadecimal
The fill() Method
The background() Method
The line() Method
The stroke() and strokeWeight() Methods
The curve() Method
The vertex() and curveVertex() Methods
Capturing Simple User Interaction
The mouseX and mouseY Variables
The mousePressed() Method
The mouseReleased() and mouseDragged() Methods
The keyPressed and key Variables
Importing Libraries
Downloading Libraries
Loading Things into Processing
Loading and Displaying Images
The PImage class
The loadImage() method
The image() method
Displaying Videos in the Processing Environment
Using the Movie Class
Reading and Writing Files
The loadStrings() method
The saveStrings() method
Running and Debugging Applications
Exporting Processing Applications
Conclusion
Review
4. Arduino
Starting with Arduino
Installing the IDE
Mac OS X
Windows
Linux
Configuring the IDE
Touring Two Arduino Boards
The Controller
Duemilanove Versus Mini
What’s a pin?
Digital versus analog pins
Pins on the Mini versus Duemilanove
Touring the Arduino IDE
The Basics of an Arduino Application
The setup Statement
The loop Method
Features of the Arduino Language
Constants
Methods
Arrays
Strings
How to Connect Things to Your Board
Hello World
Debugging Your Application
Importing Libraries
Running Your Code
Running Your Board Without a USB Connection
Review
5. Programming Revisited
Object-Oriented Programming
Classes
The Basics of a Class
Class Rules
Public and Private Properties
Inheritance
Processing: Classes and Files
C++: Classes and Files
.cpp and .h
A Simple C++ Application
Pointers and References
Reference
Pointer
When to Use Pointers
Large Data Objects
Pointers and Arrays
When Are You Going to Use This?
Review
6. openFrameworks
Your IDE and Computer
Windows
Visual Studio
Code::Blocks for Windows
Mac OS X
Linux
Code::Blocks for Linux
Using makefiles
Taking Another Quick Tour of C++
Basic Variable Types
Arrays
Methods
Classes and Objects in C++
Getting Started with oF
Touring an oF Application
Methods
Variables
Creating “Hello, World”
Drawing in 2D
Setting Drawing Modes
Drawing Polygons
Displaying Video Files and Images
Images
Video
Importing Libraries
ofxOpenCv
ofxVectorGraphics
ofxVectorMath
ofxNetwork
ofxOsc
Compiling an oF Program
Compiling in Xcode
Compiling in Code::Blocks
Debugging an oF Application
Using the printf Statement
Using the GNU Debugger
Using the Debugger in Xcode
Using the Debugger in Code::Blocks
Review
II. Themes
7. Sound and Audio
Sound As Feedback
Sound and Interaction
How Sound Works on a Computer
Audio in Processing
Instantiating the Minim Library
Generating Sounds with Minim
Filtering Sounds with Minim
Sound in openFrameworks
openFrameworks and the FMOD Ex Library
The Sound Object Library
The Magic of the Fast Fourier Transform
Physical Manipulation of Sound with Arduino
A Quick Note on PWM
Creating Interactions with Sound
Further Resources
Review
8. Physical Input
Interacting with Physical Controls
Thinking About Kinetics
Getting Gear for This Chapter
Controlling Controls
The Button As an Electrical Object
The Button As an Interactive Object
The Button As a Value in Code
Turning Knobs
The Dial As an Interactive Object
Potentiometers
Using Lights
Wiring an LED
Detecting Touch and Vibration
Reading a Piezo Sensor
Getting Piezo Sensors
Communicating with Other Applications
Sending Messages from the Arduino
openFrameworks
Detecting Motion
PIR Motion Sensor
Reading Distance
Reading Input from an Infrared Sensor
Understanding Binary Numbers
Binary Numbers
Bits and Bit Operations
Why Do You Need to Know Any of This?
Detecting Forces and Tilt
Introducing I2C
What Is a Physical Interface?
What’s Next
Review
9. Programming Graphics
The Screen and Graphics
Seeing Is Thinking, Looking Is Reading
Math, Graphics, and Coordinate Systems
Drawing Strategies
Use Loops to Draw
Use Arrays to Draw
Draw Only What You Need
Use Sprites
Processing and Transformation Matrices
Creating Motion
Shaping the Gaze
Setting the Mood
Creating Tweens
Using Vectors
Using Graphical Controls
ControlP5 Library
Event Handling
Importing and Exporting Graphics
Using PostScript in Processing
Using PostScript Files in oF
What’s Next
Review
10. Bitmaps and Pixels
Using Pixels As Data
Using Pixels and Bitmaps As Input
Providing Feedback with Bitmaps
Looping Through Pixels
Manipulating Bitmaps
Manipulating Color Bytes
Using Convolution in Full Color
Analyzing Bitmaps in oF
Analyzing Color
Analyzing Brightness
Detecting Motion
Using Edge Detection
Using Pixel Data
Using Textures
Textures in oF
Textures in Processing
Saving a Bitmap
What’s Next
Review
11. Physical Feedback
Using Motors
DC Motors
Stepper Motors
Other Options
Using Servos
Connecting a Servo
Communicating with the Servo
Wiring a Servo
Using Household Currents
Working with Appliances
Introducing the LilyPad Board
Using Vibration
Using an LED Matrix
Using the Matrix Library
Using the LedControl Library
Using the SPI Protocol
Using LCDs
Serial LCD
Using Solenoids for Movement
What’s Next
Review
12. Protocols and Communication
Communicating Over Networks
Using XML
Understanding Networks and the Internet
Network Organization
Network Identification
Network Data Flow
Handling Network Communication in Processing
Client Class
Server Class
Sharing Data Across Applications
Understanding Protocols in Networking
Using ofxNetwork
Creating Networks with the Arduino
Initializing the Ethernet Library
Creating a Client Connection
Creating a Server Connection
Using Carnivore to Communicate
Installing the Carnivore Library
Creating a Carnivore Client
Communicating with Bluetooth
Using Bluetooth in Processing
Installing Bluetooth on Linux and Windows
Installing Bluetooth on Mac OS X
Using the bluetoothDesktop Library
Using the Arduino Bluetooth
Communicating Using MIDI
Review
III. Explorations
13. Graphics and OpenGL
What Does 3D Have to Do with Interaction?
Understanding 3D
Working with 3D in Processing
Lighting in Processing
Controlling the Viewer’s Perspective
Making Custom Shapes in Processing
Using Coordinates and Transforms in Processing
Working with 3D in OpenGL
So, What Is OpenGL?
Transformations
OpenGL in Processing
Open GL in openFrameworks
Using Matrices and Transformations in OpenGL
Using Vertices in OpenGL
Drawing with Textures in oF
Lighting in OpenGL
Blending Modes in OpenGL
Using Textures and Shading in Processing
Applying Material Properties
Using Another Way of Shading
What Does GLSL Look Like?
Vertex Shaders
Fragment Shader
Variables Inside Shaders
Using an ofShader Addon
What to Do Next
Review
14. Detection and Gestures
Computer Vision
Interfaces Without Controls
Example CV Projects
OpenCV
Using Blobs and Tracking
Starting with ofxOpenCV
Tracking Blobs with ofxOpenCV
Taking a quick foray into virtual methods
Using the velocity of blobs
Using OpenCV in Processing
Exploring Further in OpenCV
Detecting Gestures
Using ezGestures in Processing
Using Gestures in oF
Implementing Face Recognition
Exploring Touch Devices with oF
TouchKit
Tuio
Touchlib
reacTIVision
What’s Next
Review
15. Movement and Location
Using Movement As and in Interaction
Using Software-Based Serial Ports
Understanding and Using GPS
Storing Data
Logging GPS Data to an Arduino
Using the Breadcrumbs Library
Implementing Hardware-Based Logging
Sending GPS Data
Determining Location by IP Address
What to Do Next
Review
16. Interfaces and Controls
Examining Tools, Affordances, and Aesthetics
Reexamining Tilt
Exploring InputShield
Understanding Touch
Exploring Open Source Touch Hardware
Nort_/D
Liquidware TouchShield
Drawing to the TouchShield Screen
Controlling Servos Through the TouchShield
Setting Up Communication Between Arduino and TouchShield
Communicating Using OSC
Using the Wiimote
Using the Wii Nunchuck in Arduino
Tracking Wii Remote Positioning in Processing
What’s Next
Review
17. Spaces and Environments
Using Architecture and Space
Sensing Environmental Data
Using an XBee with Arduino
Creating a Simple Test
Configuring the XBee Module
Addressing in the XBee
XBee Library for Processing
Placing Objects in 2D
Using the X10 Protocol
Setting Up an RFID Sensor
Reading Heat and Humidity
What’s Next
Review
18. Further Resources
What’s Next?
Software Tools
ARToolKit
PureData
Max/MSP
vvvv
Flash
Construction Processes
Artificial Intelligence
Neural nets
Pathfinding
Genetic algorithms
Artificial life
Physics
Chipmunk
Box2D
Other Processing physics libraries
ofAddons
Hardware Platforms
Phidgets
Robotshop Rover
Fritzing
AVR
ARM
PIC
Bibliography
Interaction Design
Programming
Hardware
Art
Conclusion
A. Circuit Diagram Symbols
Programming Glossary
Index
Colophon
← Prev
Back
Next →
← Prev
Back
Next →