Adafruit MAX31850

Hey guys,

I’m having some problems locating a working library for the MAX31850 to use with my photon.

In the step by step Adafruit tutorial they mention that the OneWire and DallsTemp libraries both needed to be patched to support the MAX31850. On GitHub I found someone that has made the code work for the spark core but it doesn’t compile for me - https://github.com/tomdeboer/SparkCoreDallasTemperature/pull/1/files.

This is the code I’m running:

// this is the standard library available in the IDE
#include "OneWire/OneWire.h"

// I imported this library from the PR I mentioned before:
// https://github.com/tomdeboer/SparkCoreDallasTemperature/pull/1/files
#include "spark-dallas-temperature/spark-dallas-temperature.h"

// OneWire ow = OneWire(D4);
DallasTemperature dallas(new OneWire(D4));

void setup() {
}

void loop() {
}

And this is the error:

spark-dallas-temperature/spark-dallas-temperature.cpp: In member function 'int16_t DallasTemperature::calculateTemperature(const uint8_t*, uint8_t*)': spark-dallas-temperature/spark-dallas-temperature.cpp:448:16: error: 'NAN' was not declared in this scope
         return NAN;
                ^

I think I understand the error but what I don’t understand is how to tell if the library is photon compatible and if it isn’t how to make it so. Any help would be greatly appreciated.

Thanks

Tim

You could try #include <math.h>

I think that statement should return a Not-A-Number value, and I guess math.h has got such a constant defined.

1 Like

Hey @ScruffR - that was it. Thanks.

1 Like