Spark-dallas-temperature compile error

Trying to use this library in a new app

Here is a sample of a newly created empty app

// This #include statement was automatically added by the Particle IDE.
#include <OneWire.h>

// This #include statement was automatically added by the Particle IDE.
#include <spark-dallas-temperature.h>

DallasTemperature dtSensors(new OneWire(D2));

void setup() {

}

void loop() {

}

The compile error is: lib/spark-dallas-temperature/spark-dallas-temperature.h:27:36: …/OneWire/OneWire.h: No such file or directory

Over the last few years, I have built a dozen or more applications using DS18B20 sensors and this code. The existing apps still compile without error. They have also been working without problems for a ;year or more each.

I’ve been away from buildiing apps for a year or so, So clearly something has changed with the build environment. I’m using the web IDE.

Can anyone offer a clue as to how I get this working again?

I can copy the code for the library into my application, make one change to the .h include statement, and it works. But seems like not the right thing to do for every app. It would be nice to have local libraries, but as I understand, they only work in the desktop IDE, and that will not run correctly on my windows 10 computer.

I’m obviously confused by the whole libraries 2.0 “feature”

I would switch to using the DS18B20 library in the community libraries. This library is actively maintained and I use it and it works great.

https://build.particle.io/libs/DS18B20/0.1.8/tab/DS18B20.cpp

The OneWire and spark-dallas-temperature have not been updated in a long time and no longer work properly.

I would if I could, but the new libraries are missing functionality.

Impossible to use in an application that must be responsive, as there is no asynchronous capability that I can find.

Specifically I make use of the following features:

setResolution()
with no sensor address sets resolution for all sensors
I can work around this one.

setWaitforConversion(false)
enables ansynchronus use

RequestTemperatures()
causes all sensors to update with no delay, then use:

After conversion timer has completed. (many iterations of loop() later

ReadTemperature()
for each sensor and there is no 750ms delay for each sensor

In that case, the best option is probably to make a fork of spark-dallas-temperature and fix the include definition. It probably would also be a good idea to make it have a library dependency on OneWire so you only need to include spark-dallas-temperature in your project.

2 Likes

i find myself in the same boat as brianD as i attempted to re-create an old proton app with new sensors. looking in the library i find many spark-dallas-temp ~~ versions as well as a variety of ds18 / onewire / wire libraries. wondering if there is any pertinent updates to this thread.

is there any way to tell which libraries are valid for current use? my app will use ds18b20s

BTW, I did create a new app, then copy/paste most of the old app. But I get hung up in brianD’s original ‘include fail’.

EDIT: I am rewriting my code to use the DS19B20 library. Thanks RICKKAS7.

FIXED, kinda.
I did convert to the ds18b20 library and removed references to spark-dallas-temperature in my code. I did continue to get the brianD errors UNTIL…

I forgot to remove the old library (both OneWire.h and spark-dallas-temperature.h) from the list of “Included Libraries” found in the Particle Apps column below the app name. :flushed::crazy_face: i.e. it was my own error!

1 Like