So here’s another issue I found in the Beginning Arduino book I mentioned in a previous post. I was trying to work out Project 37, but I kept getting the same temperature reading over and over. After playing around with the code, I found out that the author forgot to add a simple line to the loop() function.

Add the following:

sensors.requestTemperatures();

to the Part 2 code from the book:

void loop()
{
  // print the temperatures
  Serial.print(“Inside Temp: “);
  printTemperature(insideThermometer);
  Serial.print(“Outside Temp: “);
  printTemperature(outsideThermometer);
  Serial.println();
  delay(3000);
}
The code in the book keeps getting the same temperatures from the sensors, but the sensors are never told to get new temperatures. Simple fix that will hopefully save people from tearing their hair out.

So one of the inspirations I had for restarting this blog was the fact that when I ran into an issue with following Michael McRoberts’ Beginning Arduino book, I couldn’t find a clear solution online. I decided that if I post my solution on this blog then hopefully some future reader of this book will be less confused than I was.

Overall, Beginning Arduino is a great book, but I disagree with the author’s claim that understanding the book requires absolutely zero experience. This may be true for the early chapters, but as the projects become more complex (and inherently more interesting), there is less explanation from the author about why certain things were done or how certain things work. This is an issue when things don’t work the way the book says they should and basic troubleshooting doesn’t find a clear solution.

I ran into this issue the most in Project 19 where I wasn’t sure if my approach was incorrect or if the author was doing something incorrect. I’m not the only one who ran into a similar issue so I will detail my approach below for when anybody else gets stuck on this project so they can have one more source of information.

Below are the components I used in my setup:

Read the rest of this entry »