Arduino Cookbook

Errata for Arduino Cookbook

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date Submitted
PDF Page 274

If you use a common cathode diplay, connect the common pin to GND not to +5V.

Richard Frank  Apr 18, 2014 
Printed, PDF, ePub, Mobi Page 116
line 6

int longValue = 1000; Is it should be long longValue = 1000;

Anonymous  Feb 05, 2014 
PDF Page 248
Code in the solution

In the solution to adjust the brighness of LEDs, the LEDs are eased in and faded out by writing to the analog pins. However this, solutions contains an 'of by one' error inside the loop. If analogWrite() has a analog value greater than 255, the LEDs go of. This results in a visible flicker because the LEDs are off for 10ms, because the brightness reaches 256 for 10ms. /*leftout*/ void loop() { if ( brightness > 255 ) { increment = -1; } else if ( brightness < 1 ) { increment = 1; } brightness = brightnes + increment; //oops brightness can become 256. //write the brightness value to the LEDs analogWrite(firstLed, brigthness); analogWrite(secondLed, brigthness); analogWrite(thirdLed, brigthness); delay(10); } I would suggest this fix note the use of 'greater than or equal' comparison operator: if ( brightness >= 255 ) { increment = -1; }

maarten  Jan 16, 2014 
Printed Page 139
Figure 4.6

The text on page 139 accompanying Figure 4.6 suggests that the Arduino's digital pin 2 is connected to the serial LCD display's transmit line, but that connection isn't shown in Figure 4.6. Later, on page 141, mention is made of a unidirectional serial device, in terms suggesting that this may be what's shown in Figure 4.6. I'm not suggesting that there's an error in the book but I'm wondering if some form of clarification might be appropriate.

Anonymous  Dec 30, 2013 
Printed Page 275
bottom of page showDigit() function

The sketch failed to run properly as all four digits were permanently on and not multiplexing. Adding the line ' digitalWrite( digitPins [digit], LOW ); ' after the line ' delay(5); ' corrected the problem. Final } also missing.

Jim Parish  Dec 06, 2013 
Printed Page 273-274
schematic 7-12 on p 273 and 2nd paragraph on p 274

for Common Cathode display not only (as the text indicated) does the line isBitset = ! isBitset; be taken out of the code, but also (and this not mentioned) does the Common needs to be connected to Gnd rather than 5V in schematic Fig 7-12.

Eloy Wouters  Nov 24, 2013 
Printed Page 149
Figure 5-2

The figure of the Mega board, on the right side, that shows the "digital" section has an error. In the upper right hand corner the figure shows the two pins, above pin 22, to be Gnd. This pin and the pin to the right of it are actually +5 Volts. The two pins below pins 52 and 53 are correctly labeled Gnd.

James Gallivan  Aug 31, 2013 
PDF Page 155
Code on top of page

In the void loop() section of the code, you put the following: digitalWrite(ledPin, HIGH); // turn LED OFF } else { digitalWrite(ledPin, LOW); // turn LED ON } However, it should be: digitalWrite ledPin, LOW); // turn the LED OFF } else { digitalWrite(ledPin, HIGH); // turn the LED ON } Otherwise, it does the opposite and the light is on until you depress the button, then turns off. However, I thank you for this mistake as it helped me understand this section better.

xKoldFuzionx  Jun 22, 2013 
Printed Page 416
First line

The sketches in section 12.6 ("Using a Real-Time Clock") make use of the "DS1307RTC" library. However, this library does not appear to be distributed with the current (1.0.1) Arduino IDE. I did, however, find a version of this library (ie, .h and .cpp files, dated 6 Mar 2010) in the Google code repository and tried installing this locally. However, compiling against this library throws up a whole raft of errors, suggesting some incompatibility with the current suite of libraries.

Fred  Mar 24, 2013 
Printed Page 253
function hueToRGB

Colour change of the LEDs is somewhat abrupt, due to (IMO) an error in the conversion function. segmentOffset = scaledHue - (segment * 256) always yields 0 because segment is defined as scaledHue / 256 Replacing it by segmentOffset = scaledHue % 256 gives a much smoother color change.

Fred Swart  Jun 25, 2012 
Printed, PDF Page 221

the sketch on this page returns errors that blinkLED is not declared

Anonymous  Dec 02, 2011