Errata

Programming Interactivity

Errata for Programming Interactivity

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page ii
masthead

Please add in this line:

Development Editor: Robyn Thomas

underneath

Editor: Steve Weiss

Marlowe  Aug 17, 2009  Jan 01, 2010
1.2.1
Sixth paragraph in section 1.2.1.

I have found on error in section 1.2.1. I'm using the Safari Books Online version, so there are no page numbers. The passage "...she doesn't don't fall..." has an extra "don't" in it, I think.

Note from the Author or Editor:
page 6 3rd paragraph. Should read:

"she doesn't fall".

Rob Lindeman  Aug 30, 2009  Jun 13, 2011
1.2.2
last paragraph in section 1.2.2.

I found two things in this paragraph.
1. 'the richness of interactive system' should be 'the richness of an interactive system'
2. The 'or' in ' "principle of least surprise" or express' should be removed.

Note from the Author or Editor:
should be:

"the richness of interactive systems"

and

"principle of least surprise" express"

Rob Lindeman  Aug 30, 2009  Jun 13, 2011
1.2.3
Second paragraph in section 1.2.3.

I think "pleasant to a use;" should be either "pleasant to use" or "pleasant to a user".

Note from the Author or Editor:
should be:

pleasant to a user

Rob Lindeman  Aug 30, 2009  Jun 13, 2011
1.2.3
Third paragraph.

"Doug Englebar's" should be "Doug Engelbart's".

Note from the Author or Editor:
change to

Doug Engelbart's

Rob Lindeman  Aug 30, 2009  Jun 13, 2011
1.2.4
Second paragraph.

"many kinds interaction" should be "many kinds of interaction"

Note from the Author or Editor:
change:
"many kinds interaction"
to
"many kinds of interaction"

Rob Lindeman  Aug 30, 2009  Jun 13, 2011
1.5.
Third paragraph of Organizing tasks.

"develop novel desktops environments" should be "develop novel desktop environments"

Note from the Author or Editor:
should read:

"develop novel desktop environments"

Rob Lindeman  Aug 30, 2009  Jun 13, 2011
1.5.
Fourth paragraph of Organizing tasks.

"in a somewhat more subversive ways as well" should be "in somewhat more subversive ways as well"

Note from the Author or Editor:
should read:

in somewhat more subversive ways as well

Rob Lindeman  Aug 30, 2009  Jun 13, 2011
1.5.
First paragraph of Creating experiences.

"viewing of a spectacle or a playing with some" should be "viewing of a spectacle or playing with some"

Note from the Author or Editor:
should read:

"viewing of a spectacle or playing with some"

Rob Lindeman  Aug 30, 2009  Jun 13, 2011
1.5.
Second paragraph of Creating experiences.

"reactive to user's actions" should be "reactive to the user's actions" or "reactive to user actions"

Note from the Author or Editor:
should read;

"reactive to user actions"

Rob Lindeman  Aug 30, 2009  Jun 13, 2011
8.14
Code example for I2C for BlinkM.

The code under the line that starts:

"Here is where you initialize the BlinkM."

There are two loop functions that are started (one is completed). I believe the first loop-function fragment should be removed:

void loop()
{
int num;
int i = 0;
if(Serial.available()) {
delay(10);
while (Serial.available())
{
serInStr[i] = Serial.read();
if(++i >= 6)
break;
}

void loop()
{
if(Serial.available() >=6) {
for(int i=0; i < 6; i++) {
serInStr[i] = Serial.read();
}
}

Note from the Author or Editor:
The code listing should read:

BlinkM_beginWithPower(); // start up the blinkM
BlinkM_setAddress( blinkm_addr ); // set the address
BlinkM_stopScript(blinkm_addr); // stop the BlinkM from running its script
Serial.begin(9600);
}

void loop()
{
if(Serial.available() >=6) {
for(int i=0; i < 6; i++) {
serInStr[i] = Serial.read();
}
}

Rob Lindeman  Sep 21, 2009  Jun 13, 2011
8.14
4th paragraph

I think "Nicolas Zambetti" should be "Nicholas Zambetti".

Note from the Author or Editor:
p.279

"Nicolas Zambetti"

should be written

"Nicholas Zambetti".

Rob Lindeman  Sep 21, 2009  Jun 13, 2011
11.2.3
First code example for servos

The code in this example is not right! For example, where is the variable "lastServoPulse" initialized/set? It is read, but never set. I am assuming this line:

refreshTime = millis(); // make sure we only update at the right moments

should read like this:

lastServoPulse = millis(); // make sure we only update at the right moments

but still, the variable needs to be initialized to millis() at some point (maybe in setup())?

Also, what is the significance of the "command" variable? It is used to store the character from the serial port, but then never really used for much.

Also, if the serial character can be between 0 and 9 (exclusive), it would be good if the text gave some description of what the values 1-8 stand for.

Finally, I think there should be a little more explanation of the code. For example, what is the magic behind the default value of 1500 for "pulseWidth"?

In general, this code is a mystery to me...

Sorry to be harsh, but I'm finding a lot of errors in the code as of late. Has this code in the text been tested thoroughly?

int refreshTime = 20;
int command;
int pulseWidth = 1500; // this is the default value
long lastServoPulse;

int servoPin = 9;

void setup(){
pinMode(servoPin, OUTPUT);
}

void loop(){
if(Serial.available()){
command = Serial.read(); // get the keyboard input
if(command > '0' && command < '9')
command = command - '0';
else{
pulseWidth = (command * 9) + 700; // get the right amount of time
command = 0; // reset to get ready for the next command
}
}
sendPulse();
}

void sendPulse(){
if(millis() - lastServoPulse > refreshTime) {
digitalWrite(servoPin, HIGH);
delayMicroseconds(pulseWidth);
digitalWrite(servoPin, LOW);
refreshTime = millis(); // make sure we only update at the right moments
}
}

Note from the Author or Editor:
The code listing on page 388-389 should read:

int command = 0;
int pulseWidth = 1500;
// this will be the center that the servo will go to if
// no commands are sent from the keyboard
int centerServo = 1500;
int servoPin = 9;

void setup(){
pinMode(servoPin, OUTPUT);
Serial.begin(9600);
pulseWidth = centerServo; // Give the servo a starting point (or it floats)
}

void loop(){
if(Serial.available()){
command = Serial.read(); // get the keyboard input
// let's assume the user or another control
// is sending a number between 1 and 9 to rotate the servo
if(command > '0' && command <= '9') {
// this turns a character into a usable integer
command = command - '0';
// now turn that number into a pulsewidth microsecond value
// you might need to change this based on the servo that you're using
pulseWidth = (command * 100) + 1000;
sendPulse();
}
} else {
// if no data is coming then just send the servo to the last position
pulseWidth = (command * 100) + 1000; // you could also put it to the center, right, or the left.
sendPulse();
}
}

void sendPulse(){
digitalWrite(servoPin, HIGH);
delayMicroseconds(pulseWidth);
digitalWrite(servoPin, LOW);
// make sure the send pulse isn't getting called too
// soon after the last time
delay(20);
}

Rob Lindeman  Sep 22, 2009 
Printed
Page 26
2nd paragraph

The text states that

Note from the Author or Editor:
Should read:

"Signed long variables can be as large as 2,147,483,647 and as low as -2,147,483,647. Floating variables can be as large as 3.40282347E+38 and as low as -3.40282347E+38."

Bill Morgan  Aug 06, 2009 
Printed
Page 27
Top of Page

the book says:
char thirdLetter = a + b; // this won't become 'ab' or 'c'

a + b should be 'a' + 'b' because otherwise it will try to add two variables named a and b.

Note from the Author or Editor:
should read:

char thirdLetter = 'a' + 'b'; // this won't become 'ab' or 'c'

Dusty B  Aug 30, 2009  Jun 13, 2011
Printed
Page 30
Last two paragraphs (two occurrences)

Text beginning

Note from the Author or Editor:
Should read:

"The previous sets..."

Bill Morgan  Aug 06, 2009  Jun 13, 2011
Printed
Page 31
Figure 2-4

The code in the figure,

Note from the Author or Editor:
Image is incorrect, needs to show

int numbers[3] = {1, 2, 3};

Bill Morgan  Aug 06, 2009 
Printed
Page 34
Last item

Note from the Author or Editor:
should be "++ and --"

Bill Morgan  Aug 06, 2009  Jun 13, 2011
Printed
Page 36
2nd code block ( >= examples)

Text reads

Note from the Author or Editor:
should be:

"'?' >= 'h' // false, since '?' is 63 in ASCII and 'h' is 104"

Bill Morgan  Aug 06, 2009  Jun 13, 2011
Printed
Page 36
3nd code block ( <= examples)

3rd example

Note from the Author or Editor:
should be "'7' is 55"

Bill Morgan  Aug 06, 2009  Jun 13, 2011
Printed
Page 42
Heading mid-page

Note from the Author or Editor:
Change to:

Passing Parameters to a Function

Bill Morgan  Aug 06, 2009  Jun 13, 2011
Printed
Page 43
3rd paragraph

Note from the Author or Editor:
Should read:

"This previous function..."

Bill Morgan  Aug 06, 2009  Jun 13, 2011
Printed
Page 62
Top of Page

the book says:
there are two ways of representing numbers in Processing in particular and computing in general: RGB and hexadecimal.

shouldn't it say "representing colors"?

Note from the Author or Editor:
should read:

there are two ways of representing colors in Processing in particular and computing in general: RGB and hexadecimal

Dusty B  Aug 31, 2009  Jun 13, 2011
Other Digital Version
62
Figure 2.6

Function declaration reads: int moneyReceived (int x)
It should read: int moneyReceived (int money)

Now the body of the function makes sense: myMoney += money;

Note from the Author or Editor:
Function declaration reads: int moneyReceived (int x)

It should read: int moneyReceived (int money)

MIB1700  Aug 07, 2010 
Printed
Page 64
4th method

the book says:
fill int(value1, int value2, int value3)

the first parenthesis should come before the first int.

Note from the Author or Editor:
should read:

"fill (int value1, int value2, int value3)

Dusty B  Aug 31, 2009  Jun 13, 2011
Printed
Page 73
2nd paragraph

Note from the Author or Editor:
So, in the previous example, you'll use..

Bill Morgan  Aug 07, 2009  Jun 13, 2011
Printed
Page 77
Last paragraph

Sentence beginning

Note from the Author or Editor:
Now that you've downloaded the library, open the libraries folder...

Bill Morgan  Aug 07, 2009 
Printed
Page 101
2nd paragraph

The descriptions (right/left, above/below) do not match Figure 4-10. I see that Fig. 4-10 is identical to Fig. 4-22. Perhaps the real 4-10 is missing.

Note from the Author or Editor:
Image is incorrect. Correct image can be found here:

http://programminginteractivity.com/4_10_img.zip

Bill Morgan  Aug 09, 2009 
Printed
Page 110
Middle

the declaration for digitalWrite is missing pinNumber.

Note from the Author or Editor:
page 110 should read:

digitalWrite(value, pin)
This method sets a digital pin to HIGH if value is high or LOW if value is low, which

Dusty B  Sep 05, 2009  Jun 13, 2011
Printed
Page 110
Middle of page

The 2nd paragraph under the description of digitalWrite says that this method has no effect if the pinMode isn't OUTPUT. However, if the pinMode is INPUT, writing HIGH does enable an internal pullup resistor. (See http://www.arduino.cc/en/Reference/DigitalWrite),

Note from the Author or Editor:
the paragraph should read:

If the pinMode() method hasn?t been used to set the pin to be OUTPUT, then calling digitalWrite will have no effect unless the pinMode has been set to HIGH, in which case it enables an internal pullup resistor.

J Dean Brock  Jan 17, 2010 
Printed
Page 120
Top

The pin number for the LED is properly defined with 'int ledPin= 13'. However, lightPin is the variable used in the rest of the example, not ledPin, so the code won't even compile.

Note from the Author or Editor:
code should read:

int lightPin= 13

Nick Garvey  Oct 13, 2009  Jun 13, 2011
Printed
Page 121
Top image

The circuit shown will short the +5V rail to ground when the button is pressed, potentially damaging the Arduino.

Note from the Author or Editor:
Wow, that's a silly one. Not sure what happened there. The updated images are available here:

http://programminginteractivity.com/4_24.zip

and I wrote a quick post about it here:

http://programminginteractivity.com/wordpress/?p=100


The image should be changed to be the image shown here:

http://programminginteractivity.com/wordpress/wp-content/uploads/2009/09/4_24.png

Toby McLaughlin  Sep 19, 2009 
Printed
Page 133
1st paragraph, code example

hello,
it seems the code example that reads:

Point pt = new Point();
pt.x = 129;
pt.y = 120;

should be the following to be consistent with the the variable names used in the class description on the previous page(132):

Point pt = new Point();
pt.xPosition = 129;
pt.yPosition = 120;

best,
Nicholas Economos

Note from the Author or Editor:
Should be changed to:

Point pt = new Point();
pt.xPosition = 129;
pt.yPosition = 120;

Nicholas Economos  Aug 14, 2009  Jun 13, 2011
Printed
Page 141
2nd Paragraph

The terms declare and define are mixed up at some points, and I believe this is a very important error as it happens at a crucial point: trying to clearly explain the difference between .cpp (definition) and .h (declaration) but actually making it more confusing by mixing up the terms!

The sentence reads:
So, why are there so many things in the .h file and so few in the .cpp? (...) If I want to
define a method that adds two numbers and returns them, I define it like so:

int addEmUp(int a, int b);

Which I believe should be:
So, why are there so many things in the .h file and so few in the .cpp? (...) If I want to
define a method that adds two numbers and returns them, I declare it like so:

int addEmUp(int a, int b);

Note from the Author or Editor:
Change to:

"So, why are there so few things in the .h file and so many in the .cpp? "

Ramon Schreuder  Mar 25, 2010  Jun 13, 2011
Printed
Page 141
Figure 5-6

the filenames at the top:

HelloWorld.cpp and HelloWorld.h

should be changed to HelloWorldApp.cpp and HelloWorldApp.h

(or of course all class names and includes should be changed instead)

Note from the Author or Editor:
Filenames should read:

HelloWorldApp.cpp and HelloWorldApp.h

Ramon Schreuder  Mar 25, 2010 
Printed
Page 143
Example 5-2, FirstClass::howManyClasses()

// once again, just a little message to say 'hello'
printf(" howManyClasses method says: 'just one class' ' \n");

should be

// once again, just a little message to say 'just one class'
printf(" howManyClasses method says: 'just one class' \n");

also note the double ' sign just after class

Note from the Author or Editor:
should read:

printf(" howManyClasses method says: 'just one class' \n");

Ramon Schreuder  Mar 25, 2010  Jun 13, 2011
Other Digital Version
146
6th paragraph

'following code snippet' should be 'preceding code snippet'.

Note from the Author or Editor:
Should read:

"In the preceding code snippet,"

Tomasz Kaye  Sep 01, 2009  Jun 13, 2011
Other Digital Version
148
First code snippet

In the example it seems that the line 'func(pName)' should be 'addExclamation(pName)' instead.

Note from the Author or Editor:
code listing should read:

void addExclamation(string* s){
*s+="!";
}
string myName = "josh";
string* pName = &myName;
addExclamation(pName);
printf( myName ); // will now be 'josh!', not 'josh'

Tomasz Kaye  Sep 01, 2009  Jun 13, 2011
Other Digital Version
148
3rd paragraph

The meaning of this paragraph is unclear because of two sentences that seem to be in opposition.

"If you have a video file, a huge photo, or a lot of sound data, you don't want to be making copies of that all over your program"

"The judicious use of the pointer is a way to allow different parts of a program to access a variable and alter that variable by making multiple copies of it"

On a plain reading these sentences are confusing. The first sentence says that you don't want to be copying large objects like videos. The second sentence confusingly suggests that pointers can be used to create multiple copies of these things (precisely what you don't want to be doing!).

Note from the Author or Editor:
should read:

"that variable without making multiple copies of it"

Tomasz Kaye  Sep 01, 2009  Jun 13, 2011
Other Digital Version
148
4th para

Under the heading 'Large Data Objects' there is a series of 'important rules to pointers' bullet points. What these rules have to do with large data objects specifically, is not clear; it looks like they're general rules abut pointers.

Note from the Author or Editor:
heading should be:

"Some rules for pointers"

Tomasz Kaye  Sep 01, 2009  Jun 13, 2011
Printed
Page 159
bottom

in the .cpp example, int NameOfClass::publicMethod() should be int NameOfClass::privateMethod()

Note from the Author or Editor:
code listing should read:

int NameOfClass::privateMethod() {
//do some other stuff
}

Dusty b  Sep 08, 2009  Jun 13, 2011
Printed
Page 162
Figure 6-2

it says ofUils instead of ofUtils

Note from the Author or Editor:
graphic has typo and should read ofUtils.

Dusty B  Sep 08, 2009 
Printed
Page 171
top

Chapter 6: openFrameworks
Drawing in 2D
The code in the book reads:

#include "ofMain.h"
#include "ofAddons.h"

According to the oF wiki, ofAddons.h is no longer in use. The project won't build and returns multiple errors. There's sort of a solution here, http://www.openframeworks.cc/forum/viewtopic.php?p=16599&, but not beginner friendly.

Note from the Author or Editor:

That is an error, but unfortunately there's not much I can do about it until we do a second edition. The addons used to all be included via the addons.h file and that didn't change until after the book was published. I put a note here http://programminginteractivity.com/wordpress/?p=133 and I'm going to update all the code samples for download but it's still a major problem.

Jared Nielsen  Jan 21, 2010 
Printed
Page 203
last paragraph

bool needs to change to boolean for processing

Note from the Author or Editor:
Line:

bool isPlaying = false;

should be:

boolean isPlaying = false;

AlexanderDumas  Aug 20, 2009  Jun 13, 2011
Printed
Page 204
top

song.stop(); will not compile under processing... every other method e.g., song.play works fine - just not song.stop...

Note from the Author or Editor:
The stop() method on page 204 should be:

void stop()
{
minim.stop();
super.stop();
}

AlexanderDumas  Aug 20, 2009  Jun 13, 2011
Printed
Page 295
3rd paragraph

Note from the Author or Editor:
Calculates a number between two numbers at a specific increment. lerp is actually short for linear interpolation

Anonymous  Aug 10, 2009  Jun 13, 2011
Printed
Page 299
Near the bottom of the page

ofRandom() * 700;

ofRandom() requires 2 arguments.

I'm assuming you meant ofRandomuf();

You also have a variable:
float modifier; at the top of pg 300 that is never used.
Nor is the j variable at the bottom of page 299..

More importantly the examples from 296-300 don't work unless
you pass the values of mouseX and mouseY into the draw method
of the MouseFollow Class(es) as they seem to not be available
from within the class themselves. Perhaps it is a problem on
my end? Nonetheless, working versions of the examples would
have been extremely helpful with the purchase of this book.

Note from the Author or Editor:
This should be changed to

ofRandomuf() * 700;

The newer version of 0.06 release of openFrameworks changed the signatures of those methods. The MouseFollow examples all extend the ofBaseApp and so should have access to the mouseX and mouseY variables. If you're using the MouseFollow within another OF application then you'll need to pass in the mouseX and Y variables. Feel free to shoot your code over to thefactoryfactory AT gmail.com and I'd be happy to help you with it. Thanks.

Stephen Braitsch  Nov 03, 2009 
Printed
Page 317
second code example

#Processing xxample in "Using Vectors"#
It's in the addForce function: I think in the brackets is something missing:

void addForce(Vector3D force){...
should be:
void addForce(PVector force){..

The original code doesn't make sense, there is no use for a constuction named "Vector3D" in it I think. In addition, if you
type it an run it, you'll get an error also at this point (printed next page):

// Add gravity to thing ..
Vector3D grav = new PVector(0,0.05)
ball.add_force(grav);

What should "Vector3d grav" do? Why add_force, think it has to be "addForce".

I typed:

PVector grav = new PVector(0, 0.5);
ball.addForce(grav);

and I think, it worked ;)..but I can't judge, if it worked the way the author want it to.

cheers!

Note from the Author or Editor:
3rd Paragraph and code listing should read:

To accurately represent the way that the mass of an object affects its movement, you need to modify the force using the mass. Mathematically, this is done by dividing the force vector by the mass. The PVector class provides a simple convenience method that you can use to do this, the div() method. The acceleration of the Ball also needs to be modified by the force; a negative force slows the acceleration, a positive force accelerates it. This is done mathematically by adding the new force vector to the ac- celeration vector to ensure that all the values of the acceleration are affected:
void addForce(PVector force) { force.div(mass); // make sure the force is modified by the mass
}
acceleration.add(force); // the acceleration is affected by the force

Anonymous  Jan 10, 2010  Jun 13, 2011
Printed
Page 359
Bottom of page in code

The code sample on 359 - 360 should initialize nHeight and nWidth first as shown below:

nHeight = img.height- 2;
nWidth = img.width - 2;
int horizLength = (nWidth * 3);
long horizOffset = horizLength - nWidth * 3;

Joshua Noble
 
Dec 11, 2009 
Printed
Page 367
last paragraph

(these are called fiducials. It is, however, a start on the road to being able to do that and should give you some ideas as you consider how to create the interaction between your users and your system.

Note from the Author or Editor:
(these are called fiducials). It is, however, a start

Anonymous  Aug 11, 2009  Jun 13, 2011
Other Digital Version
548
1st paragraph

The plug-in mentioned as

Note from the Author or Editor:

The addons site is apparently getting re-organized, apologies for the confusion. ofxSimpleGesture should be available in the code downloads for the book, and also at http://programminginteractivity.com/code_downloads.zip

Erdem Yildirimer  Aug 23, 2009 
Printed
Page 558

name should be:

Martin Kaltenbrunner

it's spelled incorrectly.

Note from the Author or Editor:
Submitted by author.

Joshua Noble
 
Aug 12, 2009  Jun 13, 2011