DS18B20 with Photon [SOLVED]


#1

Hey all, can anyone help explain or have suggestions for the following

I am trying to get the Dallas Semiconductor DS18B20 temp chip to work with the Photon. The following code
compiles and works on a Core. However, when I select a Photon I get the library errors shown at the bottom.
I don’t know how to interpret the errors. Thanks.

// This #include statement was automatically added by the Spark IDE.
#include "OneWire/OneWire.h"

// This #include statement was automatically added by the Spark IDE.
#include "spark-dallas-temperature/spark-dallas-temperature.h"

#define ONE_WIRE_BUS D2  //data on pin d2
//#pragma SPARK_NO_PREPROCESSOR
double tempc=0.0;
double tempf=0.0;
int rssi =0;


OneWire oneWire(ONE_WIRE_BUS);  // Setup a oneWire instance to communicate with any OneWire devices 
DallasTemperature sensors(&oneWire);  // Pass our oneWire reference to Dallas Temperature.


void setup(void)
{
//Serial.begin(9600);    
sensors.begin();    // IC defaults to 9 bit. If you have trouble consider changing to 12. 
Spark.variable("tempc", &tempc, DOUBLE);   //expose vars to web interface  
Spark.variable("tempf", &tempf, DOUBLE); 
Spark.variable("rssi", &rssi, INT);
pinMode(7, OUTPUT);
}                                           


void loop(void)
{
sensors.requestTemperatures();        // Send the command to get temperatures from all sensors on the one wire bus
tempc = sensors.getTempCByIndex(0);     //  0 refers to the first IC on the wire 

//Serial.print(tempc);
//Serial.print("C    ");

tempf = (tempc * 9.0 / 5.0) + 32.0;
//Serial.print(tempf);
//Serial.print("F   ");

rssi=WiFi.RSSI();
//Serial.print(rssi);
//Serial.println("dbm");

digitalWrite (7, HIGH);     //quick confidence flash
delay(100);
digitalWrite (7, LOW);
delay(100);

}

OneWire/OneWire.cpp: In constructor 'OneWire::OneWire(uint16_t)':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:135:15: error: 'INPUT' was not declared in this scope
  pinMode(pin, INPUT);
               ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:135:20: error: 'pinMode' was not declared in this scope
  pinMode(pin, INPUT);
                    ^

OneWire/OneWire.cpp: In member function 'void OneWire::DIRECT_WRITE_LOW()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:142:1: error: 'PIN_MAP' was not declared in this scope
 PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin;
 ^

OneWire/OneWire.cpp: In member function 'void OneWire::DIRECT_MODE_OUTPUT()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:146:1: error: 'GPIO_TypeDef' was not declared in this scope
 GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
 ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:146:15: error: 'gpio_port' was not declared in this scope
 GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
               ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:146:27: error: 'PIN_MAP' was not declared in this scope
 GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
                           ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:149:9: error: 'GPIO_InitTypeDef' was not declared in this scope
         GPIO_InitTypeDef GPIO_InitStructure;
         ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:151:26: error: 'GPIOA' was not declared in this scope
         if (gpio_port == GPIOA )
                          ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:153:40: error: 'RCC_APB2Periph_GPIOA' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
                                        ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:153:62: error: 'ENABLE' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
                                                              ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:153:68: error: 'RCC_APB2PeriphClockCmd' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
                                                                    ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:155:31: error: 'GPIOB' was not declared in this scope
         else if (gpio_port == GPIOB )
                               ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:157:40: error: 'RCC_APB2Periph_GPIOB' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
                                        ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:157:62: error: 'ENABLE' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
                                                              ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:157:68: error: 'RCC_APB2PeriphClockCmd' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
                                                                    ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:160:5: error: 'GPIO_InitStructure' was not declared in this scope
     GPIO_InitStructure.GPIO_Pin = gpio_pin;
     ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:161:33: error: 'GPIO_Mode_Out_PP' was not declared in this scope
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
                                 ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:162:34: error: 'GPIO_Speed_50MHz' was not declared in this scope
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
                                  ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:163:30: error: 'OUTPUT' was not declared in this scope
     PIN_MAP[_pin].pin_mode = OUTPUT;
                              ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:164:45: error: 'GPIO_Init' was not declared in this scope
     GPIO_Init(gpio_port, &GPIO_InitStructure);
                                             ^

OneWire/OneWire.cpp: In member function 'void OneWire::DIRECT_WRITE_HIGH()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:168:1: error: 'PIN_MAP' was not declared in this scope
 PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin;
 ^

OneWire/OneWire.cpp: In member function 'void OneWire::DIRECT_MODE_INPUT()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:172:2: error: 'GPIO_TypeDef' was not declared in this scope
  GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
  ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:172:16: error: 'gpio_port' was not declared in this scope
  GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
                ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:172:28: error: 'PIN_MAP' was not declared in this scope
  GPIO_TypeDef *gpio_port = PIN_MAP[_pin].gpio_peripheral;
                            ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:175:9: error: 'GPIO_InitTypeDef' was not declared in this scope
         GPIO_InitTypeDef GPIO_InitStructure;
         ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:177:26: error: 'GPIOA' was not declared in this scope
         if (gpio_port == GPIOA )
                          ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:179:40: error: 'RCC_APB2Periph_GPIOA' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
                                        ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:179:62: error: 'ENABLE' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
                                                              ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:179:68: error: 'RCC_APB2PeriphClockCmd' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
                                                                    ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:181:31: error: 'GPIOB' was not declared in this scope
         else if (gpio_port == GPIOB )
                               ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:183:40: error: 'RCC_APB2Periph_GPIOB' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
                                        ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:183:62: error: 'ENABLE' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
                                                              ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:183:68: error: 'RCC_APB2PeriphClockCmd' was not declared in this scope
                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
                                                                    ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:186:5: error: 'GPIO_InitStructure' was not declared in this scope
     GPIO_InitStructure.GPIO_Pin = gpio_pin;
     ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:187:33: error: 'GPIO_Mode_IN_FLOATING' was not declared in this scope
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
                                 ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:188:30: error: 'INPUT' was not declared in this scope
     PIN_MAP[_pin].pin_mode = INPUT;
                              ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:189:41: error: 'GPIO_Init' was not declared in this scope
 GPIO_Init(gpio_port, &GPIO_InitStructure);
                                         ^

OneWire/OneWire.cpp: In member function 'uint8_t OneWire::DIRECT_READ()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:193:30: error: 'PIN_MAP' was not declared in this scope
 return GPIO_ReadInputDataBit(PIN_MAP[_pin].gpio_peripheral, PIN_MAP[_pin].gpio_pin);
                              ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:193:83: error: 'GPIO_ReadInputDataBit' was not declared in this scope
 return GPIO_ReadInputDataBit(PIN_MAP[_pin].gpio_peripheral, PIN_MAP[_pin].gpio_pin);
                                                                                   ^

OneWire/OneWire.cpp: In member function 'uint8_t OneWire::reset()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:208:15: error: 'noInterrupts' was not declared in this scope
  noInterrupts();
               ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:210:13: error: 'interrupts' was not declared in this scope
  interrupts();
             ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:214:22: error: 'delayMicroseconds' was not declared in this scope
   delayMicroseconds(2);
                      ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:221:23: error: 'delayMicroseconds' was not declared in this scope
  delayMicroseconds(480);
                       ^

OneWire/OneWire.cpp: In member function 'void OneWire::write_bit(uint8_t)':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:235:16: error: 'noInterrupts' was not declared in this scope
   noInterrupts();
                ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:238:23: error: 'delayMicroseconds' was not declared in this scope
   delayMicroseconds(10);
                       ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:240:14: error: 'interrupts' was not declared in this scope
   interrupts();
              ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:243:16: error: 'noInterrupts' was not declared in this scope
   noInterrupts();
                ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:246:23: error: 'delayMicroseconds' was not declared in this scope
   delayMicroseconds(65);
                       ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:248:14: error: 'interrupts' was not declared in this scope
   interrupts();
              ^

OneWire/OneWire.cpp: In member function 'uint8_t OneWire::read_bit()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:262:15: error: 'noInterrupts' was not declared in this scope
  noInterrupts();
               ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:265:21: error: 'delayMicroseconds' was not declared in this scope
  delayMicroseconds(3);
                     ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:269:13: error: 'interrupts' was not declared in this scope
  interrupts();
             ^

OneWire/OneWire.cpp: In member function 'void OneWire::write(uint8_t, uint8_t)':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:288:15: error: 'noInterrupts' was not declared in this scope
  noInterrupts();
               ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:291:13: error: 'interrupts' was not declared in this scope
  interrupts();
             ^

OneWire/OneWire.cpp: In member function 'void OneWire::write_bytes(const uint8_t*, uint16_t, bool)':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:299:18: error: 'noInterrupts' was not declared in this scope
     noInterrupts();
                  ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:302:16: error: 'interrupts' was not declared in this scope
     interrupts();
                ^

OneWire/OneWire.cpp: In member function 'void OneWire::depower()':
This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:346:15: error: 'noInterrupts' was not declared in this scope
  noInterrupts();
               ^

This looks like an error in OneWire library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
OneWire/OneWire.cpp:348:13: error: 'interrupts' was not declared in this scope
  interrupts();
             ^

OneWire/OneWire.cpp: In member function 'uint8_t OneWire::DIRECT_READ()':
OneWire/OneWire.cpp:194:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[1]: *** [../build/target/user/platform-6OneWire/OneWire.o] Error 1
make: *** [user] Error 2
Error: Could not compile. Please review your code.

#2

Hi @rustys36,

I think you need to specify the value of the “pin” in pinMode(pin, INPUT);

you could declare
int pin = D7;
before calling pinMode, or you could just replace the pin in pinMode with the pin you want.


#3

That sounds about right. Also, when declaring pins, use the appropriate letters. For digital 7, use D7, rather than just 7. The same goes for analog, where you’d use A7.


#4

I would also do a dfu for the 0.4.3 release if you haven’t already. I had pin mapping issues with I2C on Photon before 0.4.3 even when the code was set up correctly.


#5

This code won’t work on a Photon.

Have a look here
Libraries to Update for the Photon

There are some libraries on Particle Build using direct (fast) pin access that still need to be ported for the Photon, but due to some unexpected circumstances the necessary firmware/build farm updates had to be postponed several times, so you might have to alter the code yourself, to make it work on the Photon.

But there are also some pretty hardware specific error messages, that might not be as easy to correct.

The newest GitHub version of the OneWire lib seems to be ported already and can be found here
https://github.com/Hotaman/OneWireSpark


BTW: Welcome to the Particle world :wink:


#6

Hi guys,

I am also a newbie - thought thats over at my age, but you can never know everything.

I have more or less the same issue with getting a code sample running on the photon for a DS18b20.

Has anyone a sample code for the Photon?


#7

I tried to use the new OneWireSpark libary, but it doesn´t work.

I am currently using the WEB-Dev-Tool - is that a problem and should I develop in a local env.

Errors see below:

In file included from OneWire.h:137:0,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.cpp:137:
OneWire.h:137:21: error: #include nested too deeply
 #include "OneWire.h"
                     ^

OneWire.h:138:25: error: #include nested too deeply
 #include "application.h"
                         ^

In file included from OneWire.h:138:0,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.cpp:137:
./inc/application.h:29:26: error: #include nested too deeply
 #include "spark_wiring.h"
                          ^

./inc/application.h:30:32: error: #include nested too deeply
 #include "spark_wiring_cloud.h"
                                ^

./inc/application.h:31:37: error: #include nested too deeply
 #include "spark_wiring_interrupts.h"
                                     ^

./inc/application.h:32:33: error: #include nested too deeply
 #include "spark_wiring_string.h"
                                 ^

./inc/application.h:33:32: error: #include nested too deeply
 #include "spark_wiring_print.h"
                                ^

./inc/application.h:34:38: error: #include nested too deeply
 #include "spark_wiring_usartserial.h"
                                      ^

./inc/application.h:35:36: error: #include nested too deeply
 #include "spark_wiring_usbserial.h"
                                    ^

./inc/application.h:36:35: error: #include nested too deeply
 #include "spark_wiring_usbmouse.h"
                                   ^

./inc/application.h:37:38: error: #include nested too deeply
 #include "spark_wiring_usbkeyboard.h"
                                      ^

./inc/application.h:38:30: error: #include nested too deeply
 #include "spark_wiring_spi.h"
                              ^

./inc/application.h:39:30: error: #include nested too deeply
 #include "spark_wiring_i2c.h"
                              ^

./inc/application.h:40:32: error: #include nested too deeply
 #include "spark_wiring_servo.h"
                                ^

./inc/application.h:41:31: error: #include nested too deeply
 #include "spark_wiring_wifi.h"
                               ^

./inc/application.h:42:34: error: #include nested too deeply
 #include "spark_wiring_network.h"
                                  ^

./inc/application.h:43:35: error: #include nested too deeply
 #include "spark_wiring_client.h"  
                                   ^

./inc/application.h:44:36: error: #include nested too deeply
 #include "spark_wiring_tcpclient.h"
                                    ^

./inc/application.h:45:36: error: #include nested too deeply
 #include "spark_wiring_tcpserver.h"
                                    ^

./inc/application.h:46:30: error: #include nested too deeply
 #include "spark_wiring_udp.h"
                              ^

./inc/application.h:47:31: error: #include nested too deeply
 #include "spark_wiring_time.h"
                               ^

./inc/application.h:48:31: error: #include nested too deeply
 #include "spark_wiring_tone.h"
                               ^

./inc/application.h:49:33: error: #include nested too deeply
 #include "spark_wiring_eeprom.h"
                                 ^

./inc/application.h:50:34: error: #include nested too deeply
 #include "spark_wiring_version.h"
                                  ^

./inc/application.h:51:33: error: #include nested too deeply
 #include "spark_wiring_thread.h"
                                 ^

./inc/application.h:55:25: error: #include nested too deeply
 #include "system_task.h"
                         ^

./inc/application.h:56:25: error: #include nested too deeply
 #include "system_user.h"
                         ^

./inc/application.h:59:30: error: #include nested too deeply
 #include "platform_headers.h"
                              ^

./inc/application.h:62:19: error: #include nested too deeply
 #include "stdio.h"
                   ^

In file included from OneWire.h:137:0,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.h:137,
                 from OneWire.cpp:137:
OneWire.h:140:1: error: 'OneWire' does not name a type
 OneWire::OneWire(uint16_t pin)
 ^

OneWire.h:151:1: error: 'uint8_t' does not name a type
 uint8_t OneWire::reset(void){
 ^

OneWire.h:187:6: error: 'OneWire' has not been declared
 void OneWire::write_bit(uint8_t v){
      ^

OneWire.h:187:25: error: variable or field 'write_bit' declared void
 void OneWire::write_bit(uint8_t v){
                         ^

OneWire.h:187:25: error: 'uint8_t' was not declared in this scope
make[1]: *** [../build/target/user/platform-6OneWire.o] Error 1
make: *** [user] Error 2

#8

Just to finish that issue. Tried the same code with an updated version of OneWire 2 weeks agon, and everything works fine.

So issue SOLVED
kr


#9

@gruberlu, Thanks for the update, I’ve been testing OneWire on the Electron exclusively for the last month. Well it is running 24/7 on a Photon in my weather station without issue. Glad your up and running!

All - Make sure you are adding the latest version (you can pick the version you want). When upgrading a lib you have to remove, then re-add it to your project to actually change the code that is used.


#10

Hi !

I have same issue but that didnt worked for me. I tried the latest onewire library with the photon and the DS18B20 but I always have the error coming.

Gruberlu, what is exactly your code and wich library did you used to have everything working together ?

Tks a lot


#11

What library are you using for the DS18B20 (there are several)?
And what error?

Don’t make people guess or browse old threads when you’ve got all required info at hand


#12

Yeah sorry ScruffR but it’s about two days that I tried to do a simple thing, so get the temperature from a DS18B20 sensor with the cute photon board but I encoutered issues. Now I move on and I just tried a simple example with the OneWire.h (v 2.0.1) library from the Particle web IDE.

And with that, I get a 127 degrees temp… Could be the sensor ? Is it better to use analog sensor like the TMP36 ?

/*
Use this sketch to read the temperature from 1-Wire devices
you have attached to your Particle device (core, p0, p1, photon, electron)

Temperature is read from: DS18S20, DS18B20, DS1822, DS2438

I/O setup:
These made it easy to just ‘plug in’ my 18B20

D3 - 1-wire ground, or just use regular pin and comment out below.
D4 - 1-wire signal, 2K-10K resistor to D5 (3v3)
D5 - 1-wire power, ditto ground comment.

A pull-up resistor is required on the signal line. The spec calls for a 4.7K.
I have used 1K-10K depending on the bus configuration and what I had out on the
bench. If you are powering the device, they all work. If you are using parasitic
power it gets more picky about the value.

*/

#include “DS18.h”

DS18 sensor(D4);

void setup() {
Serial.begin(9600);
// Set up ‘power’ pins, comment out if not used!
//pinMode(D3, OUTPUT);
//pinMode(D5, OUTPUT);
//digitalWrite(D3, LOW);
//digitalWrite(D5, HIGH);
}

void loop() {
// Read the next available 1-Wire temperature sensor
if (sensor.read()) {
// Do something cool with the temperature
Serial.printf("Temperature %.2f C %.2f F ", sensor.celsius(), sensor.fahrenheit());
Particle.publish(“temperature”, String(sensor.celsius()), PRIVATE);

// Additional info useful while debugging
printDebugInfo();

// If sensor.read() didn’t return true you can try again later
// This next block helps debug what’s wrong.
// It’s not needed for the sensor to work properly
} else {
// Once all sensors have been read you’ll get searchDone() == true
// Next time read() is called the first sensor is read again
if (sensor.searchDone()) {
Serial.println(“No more addresses.”);
// Avoid excessive printing when no sensors are connected
delay(250);

// Something went wrong
} else {
  printDebugInfo();
}

}
Serial.println();
delay(15601000); //get the data every 15mn.
}

void printDebugInfo() {
// If there’s an electrical error on the 1-Wire bus you’ll get a CRC error
// Just ignore the temperature measurement and try again
if (sensor.crcError()) {
Serial.print("CRC Error ");
}

// Print the sensor type
const char *type;
switch(sensor.type()) {
case WIRE_DS1820: type = “DS1820”; break;
case WIRE_DS18B20: type = “DS18B20”; break;
case WIRE_DS1822: type = “DS1822”; break;
case WIRE_DS2438: type = “DS2438”; break;
default: type = “UNKNOWN”; break;
}
Serial.print(type);

// Print the ROM (sensor type and unique ID)
uint8_t addr[8];
sensor.addr(addr);
Serial.printf(
" ROM=%02X%02X%02X%02X%02X%02X%02X%02X",
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], addr[6], addr[7]
);

// Print the raw sensor data
uint8_t data[9];
sensor.data(data);
Serial.printf(
" data=%02X%02X%02X%02X%02X%02X%02X%02X%02X",
data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]
);
}

As you can see on the image below, the Onewire.h library is include and in the code, it’s the DS18.h that it is used. I dont really understand how the libraries works, if you have to include all the files or if you can use just a little piece of the library.


#13

Do not use D3 and D5 to sink and source current, those should be used just for communication even though they’re technically able to source up to 25mA each. Connect the ground pin of the DS sensor to GND, and connect the Vcc pin to Vin on the Photon. The Vin pin can source up to 1A.
The fact that you’re reading 127 degrees C consistently leads me to think that you’re either not handling the bit-bang from the sensor properly or the sensor is wired incorrectly (or even still, the sensor is bad).
When you choose to include a library in a project in Particle Build, the entire library gets added to project. If you just want to use a small piece of the library, then create a new .h file by clicking on the + symbol in the upper right of the code editor, and copy/paste the desired code. And don’t forget to add an include statement in your main .ino file for the .h file.


#14

I have no issues with a single DS18B20 (also switched on/off via GPIOs) with the DS18B20 library.

Since I never saw the need to investigate any of the other libs for that sensor I just stick with what I found to work (or rather made work for me ;-))


#15

Thanks to tommy_boy ! Effectively, that was the issue, the wiring wasn’t correct. Now, all is good and works like a charm !


#16

Nice @Locker. I’ll admit I’ve fried a couple DS18B20’s by switching VDD and GND accidentally.
I had to write a routine to help rule out outlying readings I would sometimes get from the DS18B20. Sometimes the sensor readings would be off by up to 20 degrees but then it would return to normal the next time the sensor was read. Since I use these sensors in a mission critical application, the routine I wrote was necessary to confirm the “true” temperature. If you see your readings fluctuating unexpectedly, you may want to write your own routine.