Library include error - Web IDE


This library has broken includes ever since the introduction of Libraries v2.0 but since there exist other working libraries and noone ever could explain what the benefit of this lib over the others would be a repair hasn’t been pursued.
The only workaround I found was targetting an old system plus selecting an older version of the lib - but who really wants that when real solutions exist?


what other librarys should I move too?


I am using a photon 0.6.3


I may be a bit biased but this seems to work


are there any differences in coding?


guess a better question is where is a wrie up on the commands?


That lib is rather self explanatory and you could look at the samples provided along with it.


OK im in the process of changing to the DS18B20 library. I have been studying the coding example for multiple sensors . I have a couple of questions.

in these 2 statements

const uint32_t msSampleTime = 2500;
const uint32_t msPublishTime = 30000;

what is the uint32_t ??

in this statement

if (!isnan(temp)) celsius[i] = temp;

what is the ! mean?

thanks steve


These are C/C++ fundamentals

This is an unsigned 32 bit integer (aka. unsigned long).

The ! is the logical NOT operator.


Ah. Thanks


ScruffR, I have been studying your example for multiple sensors and have a few more coding questions. Please forgive me for asking rudimentary questions but I am still on the uphill side of the learning curve.

  1. in the line

float celsius[nSENSORS] = {NAN, NAN}; what is NAN? I have seen that before in the onewire library

  1. I am confused by this line. What does it do?
    if (!isnan(temp)) celsius[i] = temp;

  2. is this returning a value for temp? whats the " _" for?

return _temp;

I am just generally confused by the use of _temp is it the same as temp?

Thanks again steve

This is the code for multiple sensors

#include <DS18B20.h>

const int MAXRETRY = 3;
const int pinOneWire = D2;
const int pinLED = D7;
const uint32_t msSampleTime = 2500;
const uint32_t msPublishTime = 30000;
const int nSENSORS = 2;

DS18B20 ds18b20(pinOneWire);

retained uint8_t sensorAddresses[nSENSORS][8];

float celsius[nSENSORS] = {NAN, NAN};

void setup() {
  pinMode(pinLED, OUTPUT);

  ds18b20.resetsearch();                 // initialise for sensor search
  for (int i = 0; i < nSENSORS; i++) {   // try to read the sensor addresses[i]); // and if available store

void loop() {
  static uint32_t msSample = 0;
  static uint32_t msPublish = 0;

  if (millis() - msSample >= msSampleTime) {
    msSample = millis();
    for (int i = 0; i < nSENSORS; i++) {
      float temp = getTemp(sensorAddresses[i]);
      if (!isnan(temp)) celsius[i] = temp;

  if (millis() - msPublish >= msPublishTime) {
    msPublish = millis();
    Serial.println("Publishing now.");

double getTemp(uint8_t addr[8]) {
  double _temp;
  int   i = 0;

  do {
    _temp = ds18b20.getTemperature(addr);
  } while (!ds18b20.crcCheck() && MAXRETRY > i++);

  if (i < MAXRETRY) {
    //_temp = ds18b20.convertToFahrenheit(_temp);
  else {
    _temp = NAN;
    Serial.println("Invalid reading");

  return _temp;

void publishData() {
  char szInfo[64];
  snprintf(szInfo, sizeof(szInfo), "%.1f �C, %.1f �C", celsius[0], celsius[1]);
  Particle.publish("dsTmp", szInfo, PRIVATE);


Questions like 1) & 2) are easily investigated via Google tho’

For 3) look here

double getTemp(uint8_t addr[8]) {
  double _temp;
  return _temp;

Would you also be confused if I called _temp like localTemp instead?