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.
Version |
Location |
Description |
Submitted By |
Date submitted |
Date corrected |
Other Digital Version |
section 18.3
para 10 (not counting code), para 11 (counting code as one para) |
"...and when this is divided by the prescale factor of 64, each count of the timer will be 40,000 nanoseconds (62.5 * 64 = 40,000, which is four microseconds)."
Both instances of "40,000" should read "4,000". The value given finally in microseconds is correct.
PS: This book's document format (.mobi) doesn't give page numbers as I read the text -- this makes reporting errata via this Web form problematic.
Note from the Author or Editor: the text on page 561 should read:
each count of the timer will be 4000 nanoseconds (62.5 * 64 = 4000, which is four microseconds).
|
Michael M Butler |
Apr 26, 2011 |
Aug 05, 2011 |
Printed |
Page xvii
First paragraph under "Arduino Platform Release Notes" |
Change "version 0018 through version 0020" to:
"version 0018 through version 0022"
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed, PDF, ePub, Mobi |
Page FIG 7-15
Diagram |
Figure 715 shows wiring for a MAX72xx driving an 8x8 LED array.
The figure appears to show Anodes connected to the Dig lines. Surely it should be Anodes connected to the Seg lines, see http://arduino.cc/playground/Main/MAX72XXHardware
it says: Wiring a Led matrix : "you must connect the anodes to the Seg lines and cathodes to the Dig lines "
Note from the Author or Editor: Connections shown to the digit pins should go to the segment pins, connections shown to segment pins should go to digit pins. Figure 7-15 will be updated with this change in future editions
|
Anonymous |
Dec 04, 2012 |
May 17, 2013 |
Printed, PDF, |
Page 16
1st sketch |
The initial sketch provided for the LDR/Blink problem, at the top of page 16, causes a compilation error because "minDuration" and "maxDuration" have not been defined, as they are in subsequent sketches. Also, this first sketch includes the map function, which is supposed to be *introduced* in the 2nd LDR/Blink sketch.
Note from the Author or Editor: The lines with the print and map functions (2nd and 3rd lines in the Solution sketch loop function) should be deleted. The download code is correct.
The last sentence of the first paragraph on page 16 should be changed from: " ... so the blink rate increases with light intensity."
to: " ... so the blink time increases with light intensity."
|
Tom O. |
May 04, 2011 |
Aug 05, 2011 |
Printed |
Page 16
void loop() code in Discussion section |
Under:
rate = map(rate, 200,800,minDuration, maxDuration); // convert to blink rate
add:
if(rate <minDuration)
rate = minDuration; // constrain the value
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 17
bottom |
"Figure 1-8. Connections for a speaker with the LDR circuit" has connected the digital pin 9 to use a speaker but in the code still using the digital pin 13.
const int ledPin = 13;
...
pinMode(ledPin, OUTPUT);
...
void loop()
{
int sensorReading = analogRead(sensorPin); // read the analog input
int rate = map(sensorReading, 200,800,minDuration, maxDuration);
rate = rate / 100; // add this line for audio frequency
digitalWrite(ledPin, HIGH); // set the LED on
delay(rate); // wait duration dependent on light level
digitalWrite(ledPin, LOW); // set the LED off
delay(rate);
}
Note from the Author or Editor: Pin 9 should be used instead of pin 13 when when connecting the speaker as per the diagram. The code in the download is correct.
|
Anonymous |
Mar 21, 2011 |
Aug 05, 2011 |
Printed |
Page 17
void loop() at middle of page |
Under:
rate = map(rate, 200,800,minDuration, maxDuration); // convert to blink rate
add:
if(rate <minDuration)
rate = minDuration; // constrain the value
|
|
Aug 01, 2011 |
Aug 05, 2011 |
PDF |
Page 18
First line of code |
Change:
const int ledPin = 9; // LED connected to digital pin 9
to:
const int ledPin = 9; // Speaker connected to digital pin 9
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 25
Code at bottom of page |
Two lines of code in loop() reference an undeclared variable "i" instead of the declared "index."
The 1st line with error: int val = digitalRead(inputPins[i]);
Corrected: int val = digitalRead(inputPins[index]);
The 2nd line with error: digitalWrite(ledPins[i], LOW);
Corrected: digitalWrite(ledPins[index], LOW);
Note from the Author or Editor: the variable i in the loop function should be replaced by index.
The latest download code is correct.
|
Tom O. |
May 04, 2011 |
Aug 05, 2011 |
Printed |
Page 26
26-27 |
Hi
I have just started to read the Arduino Cookbook, and have got to your definition of Dimensions of Arrays on page 26; it reads:
"The number of elements is called the dimension of the array"
I believe this to be incorrect. The sentence should read:
"The number of elements is called the size of the array"
The dimension of the array refers to arrays which have arrays as elements.
So an array of arrays would be a 2 dimensional array, and an array with elements of 2d arrays would be a 3d array and so on.
It is described better here:
http://www.cplusplus.com/doc/tutorial/arrays/
This error is continued on page 27.
Regards
Keith Gell
Note from the Author or Editor: I used the terminology from the book: Practical C Programming by Steve Oualline (O?Reilly)
The second paragraph of Chapter 5 on arrays in that book says: ?The number of elements in an array is called the dimension of the array?
However, I do think that it would be clearer to use the term size here and I will change the nine occurrences on page 27 of dimension to size the next edition.
|
keith gell |
May 22, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 29
Discussion section |
The first sentence should read "This sketch creates three variables of type String, called text1, text2 and text3." Thereafter, the incorrect usage of "message" and "anotherMessage" should be corrected.
Note from the Author or Editor: change:
This sketch creates two variables of type String, called message and anotherMessage.
to:
This sketch creates three variables of type String, called text1,text2 and text3.
change:
... in this case, it appends the contents of anotherMessage to the end of message
to:
... in this case, it appends the contents of text2 to the end of text1
|
Ross McKenzie |
May 24, 2011 |
Aug 05, 2011 |
PDF |
Page 31
1st paragraph |
In the first paragraph, Recipe 2.5 is mentioned as dealing with Arduino arrays in general. However, Recipe 2.5 deals with Arduno String functionality. So, Recipe 2.4 should be mentioned instead.
Note from the Author or Editor: Change reference to recipe 2.5 to recipe 2.4
|
Antonio Barros |
Sep 05, 2011 |
Dec 09, 2011 |
Printed |
Page 32
Bottom of page |
add the following in new lines after Paul:
Mary
(Mary is repeated every 5 seconds)
|
|
Aug 01, 2011 |
Aug 05, 2011 |
PDF |
Page 32
Bottom of page, in sketch |
fix comment wrap in loop code. Change:
Serial.println(message); // if there is text after the last comma,
print it
to:
Serial.println(message); // if there is text after the last comma,
// print it
(indent to align the ?//? below the preceding comment)
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed |
Page 33
Top |
Should read ...
The Serial Monitor will display the following:
Peter,Paul,Mary
Peter
Paul
Mary
(Mary is repeated every 5 seconds)
In the following paragraph, it could be better expressed as ...
"If there is a comma, the substring function is used to print the text from the beginning of the string up to, but excluding the comma. The text that was printed and its trailing comma are removed from message in this line:"
"commaIndex" should read "commaPosition".
Note from the Author or Editor: change:
If there is a comma, the substring function is used to print the text from the beginning of the string to the position of the comma. The text that was printed is removed from message in this line
to:
If there is a comma, the substring function is used to print the text from the beginning of the string up to, but excluding the comma. The text that was printed and its trailing comma are removed from message in this line
change:
commaIndex
to:
commaPosition
|
Ross McKenzie |
May 24, 2011 |
Aug 05, 2011 |
PDF |
Page 33
Discussion sketch |
Fix comment wrap from:
const int MAX_STRING_LEN = 20; // set this to the largest string you'll process
to:
const int MAX_STRING_LEN = 20; // set this to the largest string
// you'll process
Note from the Author or Editor: The comment text has wrapped to the next line, the download code has this corrected.
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed |
Page 33
Top of page |
Change:
sets the variable commaPosition with the position
to:
sets the variable commaPosition to the position
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed |
Page 33
Middle of page |
After "const int MAX_STRING_LEN = 20;", change:
LEN = 20; // set this to the largest string
// you'll process
to:
LEN = 20; // set this to the largest string
// you will process
Also, add space to align with comment above.
|
|
Aug 01, 2011 |
Aug 05, 2011 |
PDF |
Page 41
2nd paragraph |
The author describes a function and a way to avoid a temporary variable. Nevertheless, the function (sensorPercent) does use the "val" temporary variable, and does not declare it - the code would not compile. Since a temporary variable is still used, the example is kind of wrong, or confusing at best.
Book reads:
int sensorPercent(int pin)
{
val = analogRead(pin); // read the sensor (ranges from 0 to 1023)
return map(val,0,1023,0,100); // percent will ranges from 0 to 100.
}
It should read:
int sensorPercent(int pin)
{
int val = analogRead(pin); // read the sensor (ranges from 0 to 1023)
return map(val,0,1023,0,100); // percent will ranges from 0 to 100.
}
Note from the Author or Editor: the following code on pages 40 and again on page 41 should be changed from:
val = analogRead(pin); // read the sensor (ranges from 0 to 1023)
to:
int val = analogRead(pin); // read the sensor (ranges from 0 to 1023)
the text:
The same functionality can be achieved without using a temporary variable
should be changed to:
The same functionality can be achieved without using the percent temporary variable
|
Ed |
May 19, 2011 |
Aug 05, 2011 |
PDF |
Page 43
Very top of page (recipe 2.11A) |
Fix comment wrap from:
void swap(int &value1, int &value2); // functions with references must be
declared before use
to:
// functions with references must be declared before use
void swap(int &value1, int &value2);
Note from the Author or Editor: The comment text has wrapped to the next line, the download code has this corrected.
|
|
Jul 19, 2011 |
Aug 05, 2011 |
PDF |
Page 43
Very top of page |
Where it says:
// functions with references must be declared before use
void swap(int &value1, int &value2);
Add a comment below "// functions with references must be declared before use" that says:
// in all but the latest Arduino releases
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed |
Page 47
First sentence of "Solution" |
The first sentence should read "This sketch counts from zero to three by printing the value ..."
Note from the Author or Editor: change the first sentence in the solution to:
"This sketch counts from zero to three by printing the value ..."
|
Ross McKenzie |
Jun 05, 2011 |
Aug 05, 2011 |
PDF |
Page 50
next the bottom |
"pinMode(13, OUTPUT)" should be "pinMode(ledPin, OUTPUT)"
Note from the Author or Editor: change
pinMode(13, OUTPUT)
to
pinMode(ledPin, OUTPUT)
The code will work as written as long as the ledPin constant is not changed. The download code has been updated.
|
Antonio Barros |
Sep 03, 2011 |
Dec 09, 2011 |
Printed |
Page 56
Table 2-4. |
The 4 comments could be expressed more clearly as ...
"Sets bits in each place of the result to 1;" (in 3 places), plus
"Inverts the value of each bit of the result."
The bitwise operations on the numbers 3 and 1 do not change these numbers themselves, only the result.
Note from the Author or Editor: Although the text implies that the comment refers to the Result, it is clearer if it is made explicit by changing 'Comment' in table 2-4 to 'Result'.
|
Ross McKenzie |
Jun 05, 2011 |
Aug 05, 2011 |
Printed |
Page 63
Discussion |
More correctly expressed as ...
"The modulus operator is surprisingly useful, particularly when you want to see if a value is a multiple of a number."
... and in the last sentence ...
"If the result is zero, a message is printed saying the value is a multiple of 10."
Note from the Author or Editor: The current text is not wrong but the following change is clearer:
change:
The modulus operator is surprisingly useful, particularly when you want to see if a value is evenly divisible by a number.
to:
The modulus operator is surprisingly useful, particularly when you want to see if a value is a multiple of a number.
and change:
If it is zero, a message is printed saying the result is divisible
by 10
to:
If the result is zero, a message is printed saying the value is a multiple of 10.
|
Ross McKenzie |
Jun 05, 2011 |
Aug 05, 2011 |
Printed |
Page 64
Second paragraph |
ISO-8601 defines the numbering of the week days as 1 to 7. By using the number 7 in your example, you are in agreement. Therefore, in two places, you should write ...
"... the last day of the week"
... because only day 7, and its multiples, produces a modulus of zero.
Note from the Author or Editor: change text and code from 'This example tracks ...' through to the end of the Discussion
to:
This example calculates the hour on a 24 hour clock for any given number of hours offset.
void printOffsetHour( int hourNow, int offsetHours)
{
Serial.println( (hourNow + offsetHours) % 24);
}
void printOffsetHour( int hourNow, int offsetHours)
{
Serial.println( (hourNow + offsetHours) % 24);
}
|
Ross McKenzie |
Jun 05, 2011 |
Aug 05, 2011 |
Printed |
Page 66
Table 3-3 |
To agree with the table contents, the column heading should read ...
"Max(myValue, 100)"
Note from the Author or Editor: The heading for the second column in Table 3-3 should be changed from:
Max(myValue(200)
to:
max(myValue, 100)
also change table 3-2 from
Min(myValue,200)
to:
min(myValue,200)
the use of upper case in the heading was not an error but it is perhaps clearer when the case matches the case of the method name.
|
Ross McKenzie |
Jun 07, 2011 |
Aug 05, 2011 |
PDF |
Page 68
Bottom of page, in the Discussion section of Rounding Floating-Point Numbers Up and Down |
Change:
These functions are used for rounding floating-point numbers; use floor to round down
and ceil to round up.
to:
These functions are used for rounding floating-point numbers; use floor(x) to get the largest integer that is not greater than x. Use ceil to get the smallest integer that is greater than x.
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed |
Page 69
Discussion |
Line containing "Serial.println sin(rad));" should be
"Serial.println(sin(rad));"
missing opening bracket.
Note from the Author or Editor: change
Serial.println sin(rad));
to
Serial.println(sin(rad));
|
Ross McKenzie |
Jun 14, 2011 |
Aug 05, 2011 |
PDF |
Page 69
Top of page, end of Discussion section of Rounding Floating-Point Numbers Up and Down |
Add the following new paragraph to the discussion :
You can round to the nearest integer as follows:
if(floatValue > 0.0)
result = floor(floatValue + 0.5);
else
result = ceil(num - 0.5);
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed |
Page 69
3rd paragraph |
the if statement is not necessary, both lines will work for positive and negative values
Note from the Author or Editor: Recent Arduino versions have an inbuilt round function so the text (on page 77 in the second edition) should be changed from:
You can round to the nearest integer as follows:
if (floatValue > 0.0)
result = floor(floatValue + 0.5);
else
result = ceil(num - 0.5);
to:
You can round to the nearest integer as follows:
result = round(floatValue);
|
Bj?rn Sch?ttker |
Feb 20, 2012 |
May 17, 2013 |
PDF |
Page 70
End of discussion section of Using Trigonometric Functions |
change:
which happens to be the value of the constant (DEG_TO_RAD is 0.017453292519...). So, you can use whichever approach you prefer.
to:
which happens to be the same value as the constant DEG_TO_RAD (0.017453292519...). Use whichever approach you prefer.
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed, PDF, , Other Digital Version |
Page 75
second code group |
"equql" should be "equal"
Note from the Author or Editor: change:
equql
to
equal
|
Ross McKenzie |
Jun 14, 2011 |
Aug 05, 2011 |
Printed |
Page 76
last paragraph, second sentence |
Text currently reads as: "Indeed, the Arduino compiler is smart enough to recognize that shifting an integer..."
It should be: "Indeed, the Arduino compiler is smart enough to recognize that multiplying an integer..."
Note from the Author or Editor: Change:
the Arduino compiler is smart enough to recognize that shifting
to:
the Arduino compiler is smart enough to recognize that multiplying
|
Tom Silverstein |
Nov 20, 2011 |
Dec 09, 2011 |
Printed, PDF, , Other Digital Version |
Page 79
Discussion second paragraph |
Could be better expressed as ...
"Arduino does not have a function to convert a 32-bit long value into two 16-bit words ..."
Note from the Author or Editor: change:
Arduino does not have a function to make a 32-bit long value two 16-bit words
to:
Arduino does not have a function to convert a 32-bit long value into two 16-bit words
|
Ross McKenzie |
Jun 14, 2011 |
Aug 05, 2011 |
Printed |
Page 86
Discussion |
Whilst being constrained by the Arduino's definitive use of "print" as in "Serial.print() statements, it could be clearer to first timers to state ...
"To send text and numbers from your sketch via a serial link ..."
Note from the Author or Editor: change:
To print text and numbers from your sketch,
to:
To display text and numbers from your sketch on a PC or Mac via a serial link,
|
Ross McKenzie |
Jun 14, 2011 |
Aug 05, 2011 |
Printed |
Page 90
Immediately above Discussion |
The reproduced output has omitted the final line ...
"floatvalue: 66.00"
Note from the Author or Editor: The text is not intending to provide a listing but it would be better to add the following line to the end of the output listing:
floatvalue: 66.00
|
Ross McKenzie |
Jun 14, 2011 |
Aug 05, 2011 |
Printed, PDF, , Other Digital Version |
Page 97
First paragraph of section Discussion |
According to code inside loop() function at page 96, Arduino sketch should send H,10,100,1000,\r\n to Processing sketch, but at page 97 book reads that H10,100,1000,\r\n is sent (take notice of the comma after H).
Note from the Author or Editor: The sketch code in the text and download are correct but the fragment on page 97 is missing a comma.
change:
H10,100,1000,\r\n
to:
H,10,100,1000,\r\n
|
Antonio Barros |
Sep 09, 2011 |
Dec 09, 2011 |
Printed |
Page 114
code: importing section |
import java.awt.AWTException;
import java.awt.Robot;
need to be imported into the processing sketch ArduinoMouse.pde
Note from the Author or Editor: the following imports need to be added in the Processing sketch:
import java.awt.AWTException;
import java.awt.Robot;
The download sketch has been corrected.
(The second edition already has these imports so no change is needed there)
|
Chris D'Angelo |
Dec 24, 2011 |
Dec 09, 2011 |
PDF |
Page 116
First code in Solution section (recipe 4.11) |
Add missing '/' at top of sketch. Change:
*
* GoogleEarthPSX
to:
/*
* GoogleEarthPSX
Note from the Author or Editor: the download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
PDF |
Page 121
void loop() code (in recipe 4.11B) |
In void loop() portion of code, change:
Serial.print((byte)HEADER);
to:
Serial.print((byte)header);
Note from the Author or Editor: the download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed, PDF, , Other Digital Version |
Page 122
top |
Text states that a file is created "in a directory called Arduino". Is it not instead the case that this Processing sketch saves the file in a directory called Processing?
Note from the Author or Editor: Change:
This Processing sketch creates a file (using the current date and time as the filename)in a directory called Arduino.
to:
This Processing sketch creates a file (using the current date and time as the filename)in the same directory as the Processing sketch.
|
Anonymous |
Jul 17, 2011 |
Aug 05, 2011 |
PDF |
Page 126
Top of page (Recipe 4.13A) |
Remove extraneous '...' after #include <NewSoftSerial.h>.
Change:
#include <NewSoftSerial.h>
...
const int rxpin = 2;
to:
#include <NewSoftSerial.h>
const int rxpin = 2;
Note from the Author or Editor: The download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed, PDF, , Other Digital Version |
Page 126
Code example top of page |
txPin and rxPin parameters in call to NewSoftSerial are reversed. Correct order is rxPin,txPin
Note from the Author or Editor: The code for recipes 4.13 and 4.14 have the tx and rx pins reversed in the text. The current version of the download code is correct.
change:
(txpin, rxpin)
to:
(rxpin, txpin);
on page 126, and two places on page 129
change:
(txpin1, rxpin1)
(txpin2, rxpin2)
to:
(rxpin1, txpin1)
(rxpin2, txpin2)
|
talk2bruce |
Jul 21, 2011 |
Aug 05, 2011 |
Printed, PDF, , Other Digital Version |
Page 128
Figure 4-6 |
The wrong figure is printed for Figure 4-6, the correct figure can be found at this link:
https://lh3.googleusercontent.com/-xFQjpXwu64o/TebqqqdyTdI/AAAAAAAAAA4/PMkOIGbYKMs/s800/Figure_4-6.jpg
an .emf version of the corrected figure is here:
https://docs.google.com/leaf?id=0B9fNMvfWhA_cODI4MDRkYTQtZTdiMS00NjFlLWFjNWItYWQ3NDFjYTJiZjc4&hl=en_US&authkey=CPHq84oG
|
Michael Margolis |
Jun 01, 2011 |
Dec 09, 2011 |
Printed |
Page 141
End of Discussion section |
This is such a niggling point (really petty) that it may not be worth mentioning, but my first impression is that this book is so excellent that it will surely become many users' primary source of reference information for years to come.
People take these things as gospel, and I think the wording could be more precise:
It says the internal pull-up resistors are 20K Ohms. The ATmega data sheets specify that the pull-up values are 20K - 50K Ohms. For a couple of '328 CPUs that I tested, the values seem to be about 30K.
Now, you know and I know that no one in his/her right mind would design a circuit that only works with internal 20K pull-ups and not 30K or 50K pull-ups, but...
Regards,
Dave
Note from the Author or Editor: On page 141, change:
The internal pull-up resistors are 20K ohms.
To
The internal pull-up resistors are 20K ohms or more (between 20K and 50K).
|
davekw7x |
Apr 06, 2011 |
Aug 05, 2011 |
Printed |
Page 141
top code section |
comments in loop are reversed. should be...
digitalWrite(ledPin, HIGH); //turn led on
..
digitalWrite(ledPin, LOW); //turn led OFF
Note from the Author or Editor: change:
digitalWrite(ledPin, HIGH); //turn led off
to
digitalWrite(ledPin, HIGH); //turn led on
change
digitalWrite(ledPin, LOW); //turn led on
to
digitalWrite(ledPin, LOW); //turn led off
(This change is also required in the text of the second edition, the download code for that edition has been corrected)
|
Chris D'Angelo |
Dec 26, 2011 |
May 17, 2013 |
PDF |
Page 142
Bottom of page (Recipe 5.3) |
Change last void loop() variables, from:
void loop()
{
if(debounce(inPin))
{
digitalWrite(outPin, HIGH);
}
}
to:
void loop()
{
if(debounce(inputPin))
{
digitalWrite(ledPin, HIGH);
}
}
Note from the Author or Editor: The download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed |
Page 142
code example |
I am not at all sure this is an error. I am a neophyte and may not understand the code. Fantastic book BTW...
In the text it says the debounce function returns true if the switch is both closed and stable. I see how the function returns true if the switch state is stable but I am not seeing where it determines the absolute switch state itself. It seems like this code would light the LED if it was stable closed or stable open.
Note from the Author or Editor: The comment in Recipe 5.3 should be changed from:
"// debounce returns true if the switch in the given pin is closed and stable"
to:
"// debounce returns the state when the switch is stable"
|
Anonymous |
Apr 16, 2012 |
May 17, 2013 |
PDF |
Page 145
the receipe |
Unable to compile the receipe. Error message begins on line 3, which is a comment. Errors occur even after I delete all of the comment lines.
Note from the Author or Editor: Some of the comments in the code on that page wrap over to the next line. The code in the download compiles without error so you can use that.
|
John Zylka |
Jun 08, 2011 |
Aug 05, 2011 |
Printed, PDF, ePub |
Page 149
Figure 5-6 Connecting the SparkFun keyboard matrix |
Row 3 and Col 0 are reversed. Row 3 should be pin 5 and Col 0 should be pin 6
In the recipe
// this array determines the pins used for rows and columns
Should be changed to this:
const int rowPins[numRows] = {7, 5, 3, 2}; // Rows 0 through 3
const int colPins[numCol] = {8, 6, 4}; // Columns 0 through 2
Note from the Author or Editor: The published diagram and code does not matches the sparkfun part mentioned in the text. Row 3 and Col 0 are reversed.
Row 3 should be pin 5 and Col 0 should be pin 6.
The array should be as follows:
// this array determines the pins used for rows and columns
const int rowPins[numRows] = { 7, 2, 3, 5 }; // Rows 0 through 3
const int colPins[numCols] = { 6, 8, 4 }; // Columns 0 through 2
The download code has been updated.
|
laserled |
Mar 28, 2011 |
May 17, 2013 |
Printed, PDF, |
Page 159
Example sketch |
The text states that it uses floating-point calculation, but in fact, the calculation is done with 16-bit integer arithmetic and the resulting incorrect integer value is assigned to a floating-point variable.
If you run the code as presented in the text (and in the downloaded code as of April 16, 2011), you will discover that the printed values are all zero except in the case where the value from analogRead is 1023.
The correct results can be obtained of you change
[code]
float volts = (val / 1023) * referenceVolts; // calculate the ratio
[/code]
to
[code]
float volts = (val / 1024.0) * referenceVolts; // calculate the ratio
[/code]
Note from the Author or Editor: The code for recipe 7.6 as printed will appear to function but because the first iteration of the second loop will be out of bounds an incorrect pin will be written. The code for Recipe 7.6 in the download is correct.
|
Dave Evans |
Apr 16, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 160
Example sketch |
A minor cosmetic bug: The '.' and the fractional part are printed on a separate line rather than on the same line as the integer part.
Another cosmetic bug: Printing the fractional part does not show leading zeros.
An analogRead value of 673 results in a printed value of 3.61
An analogRead value of 723 shows a value 3.111
If I were just looking at the printout, not realizing what was happening, I might think that 3.61 is greater than 3.111
For me, a worse problem from a practical point of view is that, due to the presence of rather gross truncation error in the integer quotient 1023/5 and due to the fact that this is used in the quotient and modulo expressions to get the final printed results, the actual output can be tens of a percent off. Trying to interpret outputs given in thousandths of a volt or more when the actual errors can be half a volt or more doesn't make sense to me.
Note from the Author or Editor: The code for Recipe 5.9 has been corrected in the download. Future editions of the print and PDF should use the corrected code.
|
Dave Evans |
Apr 16, 2011 |
Aug 05, 2011 |
PDF |
Page 160
Middle of page in sketch |
Where it says:
long val = analogRead(batteryPin); // read the value from the sensor - note
val is a long int
fix comment wrap as follows:
long val = analogRead(batteryPin); // read the value from the sensor -
// note val is a long int
|
|
Aug 01, 2011 |
Aug 05, 2011 |
PDF |
Page 161
Middle of Discussion section |
Where it says:
Because a value of 1023 indicates 5,000 millivolts, each unit represents 5,000 divided by 1,023 millivolts (that is, 4.89 millivolts).
Add a note after this sentence as follows:
You will see both 1023 and 1024 used for converting analogRead values to millivolts. 1024 is commonly used by engineers because there are 1024 possible values between 0 and 1023. However, 1023 is more intuitive for some because the highest possible value is 1023. In practice, the hardware inaccuracy is greater than the difference between the calculations so choose whichever value you feel more comfortable with.
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 163
Table 5-3 |
The table heading for column 4 should read: R2/(R1+R2)
Note also that the sketch variables should be of type float (the sketch for this recipe in the code download is correct)
|
Michael Margolis |
Apr 13, 2011 |
Aug 05, 2011 |
Printed, Other Digital Version |
Page 177
bottom |
When using arduino 0222 I get these compilation errors for the 6.5 "Measuring Distance Accurately" sketch downloaded
ch6r5:38: error: 'TABLE_ENTRIES' was not declared in this scope
ch6r5.cpp: In function 'int getDistance(int)':
ch6r5:42: error: 'INTERVAL' was not declared in this scope
ch6r5:42: error: 'TABLE_ENTRIES' was not declared in this scope
ch6r5:43: error: 'distance' was not declared in this scope
ch6r5:48: error: 'distance' was not declared in this scope
------------------
Am I doing something wrong? Is the code after "following" supposed to optionally be integrated somehow in the code above?
Note from the Author or Editor: The constants did not match the usage in the code.
The sketch in the download has been corrected and should be used in the text in the next edition:
const int TABLE_ENTRIES = 12; // The numebr of entries in the distance table
const int INTERVAL = 250; // millivolts seperating each table entry
//up to: .5 .75 1 1.5 2 2.5
static int distance[TABLE_ENTRIES] = { 150,140,130,100,60,50, 40,35,30,25,20,15 }; // distance in cm for each 250mv
|
Anonymous |
Jul 11, 2011 |
Aug 05, 2011 |
PDF |
Page 177
Bottom of page (Recipe 6.5) |
Change:
const int NBR_ELEMS = 10;
const int firstElement = 250; // first entry is 250 mV
const int interval = 250; // millivolts between each element
static int distance[TABLE_ENTRIES] = {150,140,130,100,60,50,40,35,30,25,20,15};
to:
const int TABLE_ENTRIES = 12; // The numebr of entries in the distance table
const int INTERVAL = 250; // millivolts seperating each table entry
//up to: .5 .75 1 1.5 2 2.5
static int distance[TABLE_ENTRIES] = { 150,140,130,100,60,50, 40,35,30,25,20,15 };
// distance in cm for each 250mv
And change:
if( mV > INTERVAL * TABLE_ENTRIES )
to:
if( mV > INTERVAL * TABLE_ENTRIES-1 )
Note from the Author or Editor: The download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
PDF |
Page 179
Bottom of page in sketch |
Where it says:
const int interval = 250; // millivolts separating each table entry
//up to: .5 .75 1 1.5 2 2.5
the spacing does not work for the second line of this comment. change the comment to read:
const int interval = 250; // millivolts separating each table entry
// table contains values from 0 up to 2.5 volts
|
|
Aug 01, 2011 |
Aug 05, 2011 |
PDF |
Page 186
Bottom of page (Recipe 6.8A) |
Text before sketch should change from:
The following sketch turns on pin 2 when the temperature is above a threshold
to:
The following sketch triggers pin 13 when the temperature is above a threshold
And change 2nd line of code from:
const int outPin = 13; //2; // digital output pin
to:
const int outPin = 13; // digital output pin
Note from the Author or Editor: The download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed, PDF, , Other Digital Version |
Page 196
6.12 code (first line of page 196) |
Minor typo/capitalization of the word "Delay" in the command "Delay(1000);"
Should read, "delay(1000);"
I only noticed because I tried to run that sketch from the download example.
Note from the Author or Editor: Delay(1000) should read delay(1000)
The download code is now correct.
|
Jesse Rutherford |
Jul 12, 2011 |
Aug 05, 2011 |
PDF |
Page 197
Bottom of page (Recipe 6.13) |
Add missing semi-colon in solution. Change:
const int dataPin = 5
to:
const int dataPin = 5;
Note from the Author or Editor: the download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed, PDF, , Other Digital Version |
Page 206
Figure 6-13 |
Figure reverses power leads to the RFID reader. In the diagram, the Arduino ground pin (GND) is connected to the RFID reader VCC (5v) and the Arduino 5v pin is connected to the RFID reader's GND.
Note from the Author or Editor: The Arduino power connections are shown reversed in figure 6-13:
The RFID +5 pin should be connected to the Arduino 5V pin. The RFID Gnd pin should be connected to Arduino Gnd.
|
Scott Spare |
Mar 23, 2012 |
May 17, 2013 |
PDF |
Page 207
Middle of page, in gyro sketch (Recipe 6.15) |
In gyro sketch, fix variable names. In void setup(), change:
digitalWrite(powerDown, LOW)
to:
digitalWrite(powerDownPin, LOW)
In void loop(), change:
Serial.println(rotation rate);
to:
Serial.println(rotationRate);
Note from the Author or Editor: the download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed, PDF, ePub |
Page 226
last paragraph |
7.4 ....Use Figure 7-2 if your RGB LEDs are common cathode....
No... Figure 7.2 schematic (on page 220) does not show common cathode it shows three discrete LEDs. If common cathode all "k" are connected together in the LED package and should go directly to ground. The current-limiting resistors need to be between the 3 LED anodes and the digital pins; 3, 5, and 6.
Although the program will work. I believe since the PWMs are now working against gnd instead of 5V, the colors of the cases will be complementary.
I don't know if this error occurs in more than my printed version.
Note from the Author or Editor: For common cathode connection, the resistors should be on the anode side, not the cathode as shown in Fig 7-2. This figure will be updated in future editions.
|
Moabman |
Nov 25, 2012 |
May 17, 2013 |
PDF |
Page 231
Bottom of page (Recipe 7.5A) |
In sketch at bottom of page, change:
const int NbrLEDs = sizeof(ledPins) / sizof(ledPins[0];
const int ledPins[] = { 2, 3, 4, 5, 6, 7};
to:
const int ledPins[] = { 2, 3, 4, 5, 6, 7};
const int NbrLEDs = sizeof(ledPins) / sizeof(ledPins[0]);
Note from the Author or Editor: This error is in the text, the download code is correct.
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed |
Page 233
Second loop in the Solution sketch |
The value of NbrLEDS is 6.
The number of elements in the ledPins array is 6.
The for loop starts like this:
[code]
for (int led = NbrLEDs; led > 0; led--) {
digitalWrite(ledPins[led], HIGH);
[/code]
The first time through the loop, the array index is out of bounds.
Regards,
Dave
Note from the Author or Editor: The code for recipe 7.6 as printed will work but because the first iteration of the second loop will be out of bounds an incorrect pin will be written.
The code for Recipe 7.6 in the download is correct.
|
Dave Evans |
Apr 06, 2011 |
Aug 05, 2011 |
PDF, Other Digital Version |
Page 241
table for explanation of charlieplexing Pins and LEDs |
(Because of my poor English, I can't explain in text.)
On table of Pins and LEDs,
Pins
2 3 4
is
Pins
4 3 2
,isn't it?
Note from the Author or Editor: in the array at the bottom of page 241, change the first row of numbers from:
2 3 4 1 2 3 4 5 6
to:
4 3 2 1 2 3 4 5 6
|
Shigehiro Miyashita |
Jun 06, 2011 |
Aug 05, 2011 |
Printed, PDF, ePub |
Page 242
top 4th code section |
Not really an "error" as the charlieplexing still works but it changes the order of the LED #s in the schematic
the 2D array that maps the pins to the LED's should really be as follows if the LEDS will be mapped in order 1...6 for pins 2,3,4
byte pairs[NUMBER_OF_LEDS/2][2] = { {2,1}, {1,0}, {2,0} }; // maps pins to LEDs
the 2D array that maps the pins to the LEDs now maps them in the LED order 4, 3, 2, 1, 6, 5 according to the 2D array assigned below
byte pairs[NUMBER_OF_LEDS/2][2] = { {0,1}, {1,2}, {0,2} }; // maps pins to LEDs
Note from the Author or Editor: To make the sketch code in Recipe 7.9 sequence the LEDs to match figure 7-11, change:
byte pairs[NUMBER_OF_LEDS/2][2] = { {0,1}, {1,2}, {0,2} }; // maps pins to LEDs
to:
byte pairs[NUMBER_OF_LEDS/2][2] = { {2,1}, {1,0}, {2,0} }; // maps pins to LEDs
|
Chris D'Angelo |
Jan 02, 2012 |
May 17, 2013 |
PDF |
Page 254
Top of page (Recipe 7.13) |
In the Hello Matrix sketch, remove "instance" that wraps to next line. Change:
Matrix myMatrix = Matrix(dataPin, clockPin, loadPin); // create a new Matrix
instance
to:
Matrix myMatrix = Matrix(dataPin, clockPin, loadPin); // create a new Matrix
Note from the Author or Editor: The comment text has wrapped to the next line, the download code has this corrected.
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 264
Sweep sketch |
Two errors based on the text(*):
1) Comment doesn't match code in the following line:
myservo.attach(9); // attaches the servo on pin 10 to the servo object
2) Second for loop inside loop() re-uses angle for the counter, but the following line of code uses 'pos' instead:
myservo.write(pos); // tell servo to go to position in variable 'pos'
(*) Code from Arduino [v0022] example Servo-Sweep sketch does not contain either of these issues.
Note from the Author or Editor: Code for Recipe 8.1 in the download zip has been corrected.
|
pkb |
Apr 17, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 268
Code example for 8.3 |
int pos = 0; // variable to store the servo position
should be:
int angle = 0; // variable to store the servo position
Note from the Author or Editor: The variable name should be changed from ps to angle. The current download code is correct.
|
Dave Edwards |
May 09, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 272
Code example for 8.6 |
in setup section:
pinMode(ledPin, OUTPUT);
should be:
pinMode(solenoidPin, OUTPUT);
in loop section:
digitalWrite(ledPin, LOW); // deactivates the solenoid
should be:
digitalWrite(solenoidPin, LOW); // deactivates the solenoid
Note from the Author or Editor: Variable names should be changed as indicated, current download code is correct.
|
Dave Edwards |
May 09, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 299
jeffmad@gmail.com |
page 299 in the tip/suggestion/note, the description is not clear. pin 3 is not even in the picture, and 'another' 4.7k variable resistor is confusing because there are no 4.7k resistors in the diagram. I think that you meant to set up a voltage divider here, but it is not really explained clearly.
The voltage level (5 volts) is higher than audio amplifiers expect, so you may need to use another 4.7K variable resistor to reduce the voltage (connect one end to pin 3 and the other end to ground; then connect the slider to the tip of the jack plug).
Note from the Author or Editor: The text at the bottom of page 298 should refer to Recipe 9.7, not 5.7
The note should say:
The voltage level (5 volts) is higher than audio amplifiers expect, so you may need to use a 4.7K variable resistor to reduce the level-
connect one end to pin 9 and the other end to ground, then connect
the slider to the tip of the jack plug. The barrel of the jack plug is connected to ground.
|
Jeff Madynski |
Apr 26, 2011 |
Aug 05, 2011 |
PDF |
Page 300
Bottom of page |
Where it says:
Alternatively, you can connect the output to an external audio amplifier. Recipe 5.7
shows how an output pin can be connected to an audio jack.
Change to:
Alternatively, you can connect the output to an external audio amplifier. Recipe 9.7
shows how an output pin can be connected to an audio jack.
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed, PDF, ePub |
Page 317
1st paragraph |
text reads,"Pin 5 is used for audio output and is connected to an amplifier using a jack plug." The diagram shows Pin 3 connected to the jack plug. The downloaded Sketch code uses Pin3 as shown in the diagram.
Note from the Author or Editor: The solution text for Recipe 9.7 refers to pin 3 instead of pin 5 for audio output. The diagram and code do correctly use pin 3 so the code will work if wired according to the diagram.
The solution text for Recipe 9.7 should be changed from:
Pin 5 is used for audio output ...
to:
Pin 3 is used for audio output...
|
sharberger |
Apr 15, 2012 |
May 17, 2013 |
PDF |
Page 321
Top of page (RemoteDecode sketch) |
In RemoteDecode sketch, change comment:
// pin connected to the output of the IR
detector
to:
// pin connected to IR detector output
Note from the Author or Editor: The comment text has wrapped to the next line, the download code has this corrected.
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 326
Figure 10-2 |
The common connections to the right-hand contacts of all of the switches should go to ground, not the junction of the resistor and the LED.
Note from the Author or Editor: Figure 10-2 should be changed so the common connections to the right-hand contacts of all of the switches go to ground instead of the junction of the resistor and the LED.
|
Dave Evans |
Apr 19, 2011 |
Dec 09, 2011 |
Printed, PDF, |
Page 344
marquee function of manual scrolling for very long messages |
The marquee function of manual scrolling for very long messages displays only "A message too lo" and would not scroll messages.
To work correctly, it needs only one code between delay() and while{}.
i.e.
delay(1000);
pos = 1; // add this code then the function work correctly
while(pos <= length - numCols)
{
......
}
Note from the Author or Editor: The line setting pos to 1 prior to the while loop is missing from the code in the manuscript on page 344. The current download code has this corrected (see file chr11r4B.pde)
|
Anonymous |
May 08, 2011 |
Aug 05, 2011 |
PDF |
Page 346
Bottom of page in sketch |
Where it says:
int pos;
for( pos = 0; pos < numCols; pos++)
lcd.print(text[pos]);
delay(1000); // allow time to read the first line before scrolling
while(pos <= length - numCols)
Before the "while(pos <= length - numCols)" line, add:
pos=1;
|
|
Aug 01, 2011 |
Aug 05, 2011 |
PDF |
Page 357
Bottom of page (Recipe 11.9) |
In void setup() of sketch, change comment:
// this makes all the distributed fonts
available to your sketch
to:
// for access to all distributed fonts
Note from the Author or Editor: The comment text has wrapped to the next line, the download code has this corrected.
|
|
Jul 19, 2011 |
Aug 05, 2011 |
PDF |
Page 377
Bottom of page (Recipe 12.4B) |
At very end of sketch on page 377, after:
}
digitalClockDisplay();
}
add the following code:
}
digitalClockDisplay();
}
// functions checks to see if the time should be adjusted
// returns true if time was changed
boolean checkSetTime()
{
int step; // the number of seconds to move (backwards if negative
boolean isTimeAdjusted = false; // set to true if the time is adjusted
step = 1; // ready to step forwards
while(digitalRead(btnForward)== LOW)
{
adjustTime(step);
isTimeAdjusted = true; // to tell the user that the time has changed
step = step + 1; // next step will be bigger
digitalClockDisplay(); // update clock
delay(100);
}
step = -1; // negative numbers step backwards
while(digitalRead(btnBack)== LOW)
{
adjustTime(step);
isTimeAdjusted = true; // to tell the user that the time has changed
step = step - 1; // next step will be a bigger negative number
digitalClockDisplay(); // update clock
delay(100);
}
return isTimeAdjusted; // tell the user if the time was adjusted
}
void digitalClockDisplay(){
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
}
void printDigits(int digits){
// utility function for clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
Note from the Author or Editor: the download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
PDF |
Page 393
Bottom/middle of page |
In the last sentence before last sketch on page, delete:
The following sketch uses a function named hueToRGB that was introduced in
Chapter 7 to convert an integer value into its red, green, and blue components:
Note from the Author or Editor: the statement is correct but is not needed
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed, PDF, ePub |
Page 398
middle |
In loop(), would it be preferable for
delay(100); // the time in milliseconds between redraws
to be the last statement within
if( accx >= 75 && accx <= 185 ) {}
?
Note from the Author or Editor: The printed code is not in error, however the following will reduce delays after invalid readings. (The download code has been updated)
change
Serial.write(x);
}
delay(20); // the time in milliseconds between redraws
to:
Serial.write(x);
delay(20); // the time in milliseconds between redraws
}
|
Cary Swoveland |
May 19, 2011 |
May 17, 2013 |
PDF |
Page 412
Top of page (Recipe 13.5A) |
Fix comment wrap in sketch, by changing:
const byte NumberOfDevices = 2; // the number of TMP75 devices (with consecutive
addresses)
char tempHighByte; // high byte of temperature (this is the signed integer
value in degrees c)
char tempLowByte; // low byte of temperature (this is the fractional
temperature)
to:
const byte NumberOfDevices = 2; // nbr TMP75 devices with consecutive addresses
char tempHighByte; // high byte of temperature (this is
// the signed integer value in degrees c)
char tempLowByte; // low byte of temperature (this is
// the fractional temperature)
Note from the Author or Editor: comment wrapped to next line in text, the download file is correct.
|
|
Jul 19, 2011 |
Aug 05, 2011 |
PDF |
Page 419
Recipe 13.8 in Solution section |
Add missing "/" at top of sketch. Change:
*
SPI_Max7221_0019
*/
to:
/*
SPI_Max7221_0019
*/
Note from the Author or Editor: replace missing character from comment, download code is correct.
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed |
Page 422
IC2_Master code and IC2_Slave code (p. 423) |
IC2_Master code
1. In Setup(), add
Serial.begin(9600);
2. In loop(), before
// send the data
add
c = Serial.receive(); // get the data
IC2_Slave code
1. Change
receiveEvent(int howMany);
to
receiveEvent();
Note from the Author or Editor: 1. In Setup(), add
Serial.begin(9600);
|
Cary Swoveland |
May 19, 2011 |
Aug 05, 2011 |
Printed |
Page 424
2/3rds down |
1. In setup(), change
Wire.begin();
to
I2CDebug(address);
2. On the previous page, second line from bottom, change
byte count;
to
byte count = 0;
3. It may be helpful to add a sentence explaining the connection between I2CDebugClass::write() and Print::println();
4. It may be cleaner to remove I2CDebugClass::begin(int id) and move its content into the constructor
I2CDebugClass::I2CDebugClass(int id);
begin(), with a return value, may have been used to simplify the addition of error checking in future, but such consideration has not been given to Wire.beginTransmission() or Wire.send().
Note from the Author or Editor: In setup(), change:
Wire.begin();
to:
I2CDebug.begin(address);
on page 424 change
boolean I2CDebugClass::begin(int id)
{
I2CAddress = id; // save the slave's address
to:
boolean I2CDebugClass::begin(int id)
{
I2CAddress = id; // save the slave's address
count = 0;
|
Cary Swoveland |
May 19, 2011 |
Aug 05, 2011 |
PDF |
Page 424
Middle of page in void setup() |
Where it says:
void setup()
{
Wire.begin();
}
Change to:
void setup()
{
Wire.begin();
Serial.begin(9600);
}
|
|
Aug 01, 2011 |
Aug 05, 2011 |
PDF |
Page 426
Top of page in sketch |
Where it says:
boolean I2CDebugClass::begin(int id)
{
I2CAddress = id; // save the slave's address
count = 0;
I2CDebug(address); // join I2C bus (address optional for master)
return true;
}
Change to:
boolean I2CDebugClass::begin(int id)
{
I2CAddress = id; // save the slave's address
count = 0;
Wire.begin(); // join I2C bus (address optional for master)
return true;
}
|
|
Aug 01, 2011 |
Aug 05, 2011 |
PDF |
Page 426
Bottom of page in void setup() |
In void setup(), remove:
Wire.begin();
and replace with:
I2CDebug.begin(address);
|
|
Aug 01, 2011 |
Aug 05, 2011 |
PDF |
Page 429
First sentence of "Solution" |
change:
such as the SparkFun WRL-08946 and WRL-08770
to:
often found in low cost wireless toys.
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 439
Last line of loop(), above "Discussion" |
configureRadio(); must be replaced with configured = configureRadio(); . Also, on the previous page, "boolean configure = false;" can be changed to "boolean configure;", since "configure = configureRadio()" is executed in setup().
Great book, incidentally. At first I thought it was great because it made everything seem so simple. Then I realized using the Arduino really is simple!
Note from the Author or Editor: on 438 change:
boolean configured = false;
to:
"boolean configured;"
On Page 439, change:
configureRadio(); // try again on page 439 should be changed to:
configured = configureRadio(); // try again"
The code in the download has been corrected.
|
Cary Swoveland |
May 13, 2011 |
Aug 05, 2011 |
Printed, PDF, |
Page 444
setup() |
I don't understand why configureRadio(); needs to be executed. Specifically, I don't understand what is achieved by the following two statements on the page 445:
Serial.print("ATAP1/r"); // Enter API mode
Serial.print("ATCN/r"); // back to data mode
Note from the Author or Editor: On the Series 1 XBees, you must configure the radio for API mode manually with an AT command (ATAP1). On Series 2 XBees, this is accomplished by flashing the XBee with a different firmware version. The reason for the return to data mode (ATCN) is because we entered command mode earlier with +++ and need to return to data mode to receive data.
|
Cary Swoveland |
May 13, 2011 |
Aug 05, 2011 |
PDF |
Page 448
After figure 14-8 |
Add a note after figure 14-8 saying:
Unlike Series 2, Series 1 XBee uses an external reference connected to 3.3v. Because the voltage on the slider of the pot can never be greater than the reference voltage, the resistor shown in Figure 14-7 is not needed.
|
|
Aug 01, 2011 |
Aug 05, 2011 |
Printed |
Page 449
First sentence of last para |
I find this section very confusing. All would be clear if the sentence, "Next, wire the receiving XBee to an Arduino, as shown in recipe 14.2." were changed to, "Next, wire the receiving XBee as shown in Figure 14-9", made a separate paragraph and moved before, "Wire up the transmitting XBee to the Arduino, as shown in Figure 14.10."). Here I am assuming that everything on pages 449 and 450 after "Wire up the transmitting..." pertains to the transmitting XBee.
I do not understand why "Serial.begin(9600);" is required in setup() on page 450.
Some minor suggestions:
1. Change the first sentence on Page 450 after Figure 14-10 to "Next, load the following sketch onto the transmitting Arduino."
2. In the caption to Figure 14-7, change "...a Series 2 XBee..." to "...the receiving Series 2 XBee...".
3. In the caption to Figure 14-8, change "Series 1 XBee..." to "The receiving Series 1 XBee...".
4. In the caption to Figure 14-9, change "...digital pin 1" to "...digital pin 1 (both Series 1 and Series 2)".
5. In the caption to Figure 14-10, change "...to XBee's...""...to the Series 1 transmitting XBee's...".
Note from the Author or Editor: Remove Serial.begin from the code on page 450 (the download code has been corrected)
1. Change the first sentence on Page 450 after Figure 14-10 to "Next, load the following sketch onto the transmitting Arduino."
2. In the caption to Figure 14-7, change "...a Series 2 XBee..." to "...the receiving Series 2 XBee...".
3. In the caption to Figure 14-8, change "Series 1 XBee..." to "The receiving Series 1 XBee...".
4. In the caption to Figure 14-9, change "...digital pin 1" to "...digital pin 1 (both Series 1 and Series 2)".
5. In the caption to Figure 14-10, change "...to XBee's...""...to the Series 1 transmitting XBee's...".
|
Cary Swoveland |
May 13, 2011 |
Aug 05, 2011 |
Printed, PDF, , Other Digital Version |
Page 454
bottom |
The text says TextFinder can be downloaded from this web site but I could not find it. Instead I had to find it at the Adruino Playground.
Note from the Author or Editor: change:
It is available from the Arduino Playground and on the website for this book
to:
It is available from the Arduino Playground.
|
Ron |
May 02, 2011 |
Aug 05, 2011 |
Other Digital Version |
461
1 |
All the examples of Chapter 15 do not work with the new 1.0 version of arduino
Best Regards Marco
Note from the Author or Editor: Code for the second edition (the download is at: http://shop.oreilly.com/product/0636920022244.do) works with Arduino 1.0. The code for the first edition is for earlier Arduino releases.
|
marco pucci |
Feb 25, 2012 |
|
Printed, PDF, ePub |
Page 527
In code |
The WebServerPost sketch does not function beyond serving the initial webpage.
Line 34 should be deleted, and the 'break' on line 61 should be moved to line 46. All will then be well.
Note from the Author or Editor: The download code has been corrected and later editions have been revised
|
Cliff Randell |
Mar 08, 2012 |
Dec 09, 2011 |
PDF, Other Digital Version |
Page 536
"0th" ("tracks" note), 4th - 9th paragraph & following page |
SUMMARY:
USING AVR-OBJDUMP.EXE TO GET A DISASSEMBLY LISTING HAS GREATLY CHANGED AND APPEARS NOT-WELL-DOCUMENTED BY ARDUINO.CC FOR THE MOST RECENT RELEASE(S)
ENVIRONMENT:
This is my experience with Arduino022 on Windows XP. Other OSes might behave differently.
PROBLEM:
While the "tracks" note at the top of page 536 says "check the documentation", I've been unable to find a concise and authoritative document that describes what actually happens with Arduino022 (and allegedly with some earlier revs) re location of the .o and .elf files. Some of the official documentation appears greatly out of date.
The "applet" directory per se is long gone.
When I looked at my Temp directory, there was nothing one level down I could easily recognize; and Windows Search didn't find any .elf file having been created when I'd build using Arduino022. I'm not sure if the fact that "Application Data" is ordinarily a hidden folder in Windows was a factor in this, because in fact the files were being created a level down from there.
SIDE NOTE: No matter the location, various forum commenters have mentioned that the .o and .elf files might not survive if you close the IDE. It would be helpful if "don't close the IDE before you invoke avr-objdump.exe" were stated explicitly on this page... after confirming it as an issue, of course.
WORKAROUND:
I had to modify my "C:\Documents and Settings\{name}\Application Data\Arduino\preferences.txt" file by adding a line that reads build.verbose=true in order to find out where the .o and .elf files were being placed.
(I think that option might have been mentioned by you elsewhere in the book.)
From the presented verbose compiler output I found that the .o and .elf files were winding up in folders with (Java-obfuscated?) paths like "C:\Documents and Settings\{name}\Local Settings\Temp\build87624986362957506183.tmp\"
Some people on forums have said that there is an available preferences.txt option called "build.path" that can make the destination have a fixed and less unfriendly name, but I have not checked that for accuracy or function yet.
CONCLUSION
I don't mean to put this all on you, as what you described was probably accurate some time back; but in view of the seeming lack of other documentation in one place I thought it worthwhile to post this here.
Thanks for your attention.
Note from the Author or Editor: In the discussion of Recipe 17.1 change the following text from:
?To use the tool, compile the sketch and navigate to the folder containing the Arduino distribution. Then, navigate to the folder with all the inter-mediate files used in the build process (as explained earlier)?
To:
?To use the tool, compile the sketch and navigate to the Arduino build folder. You can find this by enabling and viewing verbose compiler output (the File->Preferences menu has a checkbox in recent versions of the IDE to select verbose output). Navigate to the folder that contains the file with the .elf file extension.?
|
Michael M. Butler |
May 22, 2011 |
May 17, 2013 |
Printed, PDF, , Other Digital Version |
Page 540
solution code |
The boundary condition for the test should be:
if (brightness > 254)
not
if(brightness > 255)
Note from the Author or Editor: The code will function as printed but 254 is the correct value for the boundry condition.
Change
if(brightness > 255)
to
if(brightness > 254)
|
Shawn Wallace |
Aug 18, 2011 |
Dec 09, 2011 |
PDF |
Page 542
17.4 code solution |
Shouldn't the string definition include the PROGMEM variable modifier? As printed, it looks like:
const prog_uchar myText[] = "arduino duemilanove ";
Shouldn't it be:
const prog_uchar myText[] PROGMEM = "arduino duemilanove ";
?
Note from the Author or Editor: The PROGMEM expression is missing from the text (the download has been corrected)
change
const prog_uchar myText[] = "arduino duemilanove ";
to
const prog_uchar myText[] PROGMEM = "arduino duemilanove ";
|
Shawn Wallace |
Aug 18, 2011 |
Dec 09, 2011 |
Printed, PDF, , Other Digital Version |
Page 556
Code sample |
feedId should be defined as a "long" as pachube is now issuing feed IDs greater than 32000.
The type should also be updated in the putFeed function.
Note from the Author or Editor: Recent Pachube feed iDs exceed the bounds of an int. The feedID variable should be declared as:
const unsigned long feedID
The source code in the download has been updated accordingly
|
Anthony Cook |
Jan 07, 2012 |
May 17, 2013 |
PDF |
Page 576
Bottom of page (Recipe 18.11) |
Fix word wrap, by changing:
const long repeatCount = 1200000 / WPM; // count used to determine
the duration of dots and dashes
to:
const long repeatCount = 1200000 / WPM; // count determines dot/dash duration
Note from the Author or Editor: Fix wrapped comment in text, download code is correct
|
|
Jul 19, 2011 |
Aug 05, 2011 |
Printed, PDF, ePub |
Page 607
|
The codes claimed to be UTF-8 are in fact ISO 8859-1 ("Latin-1").
On the page you reference, http://en.wikipedia.org/wiki/UTF-8, one can read "Codepoints larger than 127 are represented by multi-byte sequences". But you don't present any multi-byte sequences.
Unicode and ISO 8859-1 share the same code points, e.g. the letter ? (latin small letter u with diaeresis) is 0xFC in ISO 8859-1 and U+00FC in Unicode.
Its UTF-8 sequence is the two bytes 0xC3 0xBC.
So, the codes given in table G-2 are both ASCII and UTF-8.
The codes given in table G-2 are both ISO 8859-1 and ISO 10646, Unicode.
(The appendix G is also about the serial monitor.
It appears that sending bytes 160 .. 255 with Serial.write(), the serial monitor (of Arduino 1.0 on Linux) displays the characters just fine. Using strace on the java process, I can see that there's single ISO 8859-1 bytes, not UTF-8 byte sequences.
When I use
Serial.println ("????");
in a sketch though, in the .cpp it becomes
Serial.println ("\u00e4\u00f6\u00fc\u00df");
which seems to produce UTF-8, which the serial monitor interprets as Latin-1, as it displays gibberish
äöüß
text.length() also reports 8 on the board.
So there seems to be some support for UTF-8, but not in the serial monitor.)
Note from the Author or Editor: Table G-3 is missing extended characters 128-159 and the reference to UTF-8 is unnecessary.
Running the sketch at the end of Appendix G will correctly display all supported characters. Appendix G will be updated in future editions to show all extended characters.
Change the following text from:
Characters above 128 are non-English characters or special symbols and are displayed in the Serial Monitor using the UTF-8 standard (http://en.wikipedia.org/wiki/UTF-8).
Table G-3 lists the UTF-8 extended character set.
to:
Characters above 128 are non-English characters or special symbols and are displayed in the Serial Monitor using the characters shown in Table G-3.
|
Robert Joop |
Feb 25, 2012 |
May 17, 2013 |