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.
Advertisements