Missing functions (standard library)?

Hello there. I am just beginning with Photon, and starting with DS1820 sensor.
While browsing the forums I found known working example https://github.com/justinatomatic/DallasTemperature_SparkCore.git

Which is not compiling because of missing max(),**delay()**or millis() functions:

DallasTemperature.cpp: In member function 'void DallasTemperature::begin()':
DallasTemperature.cpp:59:67: error: 'max' was not declared in this scope
    bitResolution = max(bitResolution, getResolution(deviceAddress));
DallasTemperature.cpp: In member function 'void DallasTemperature::writeScratchPad(uint8_t*, const uint8_t*)':
DallasTemperature.cpp:191:25: error: 'delay' was not declared in this scope
   if (parasite) delay(10); // 10ms delay
DallasTemperature.cpp: In member function 'void DallasTemperature::setResolution(uint8_t)':
DallasTemperature.cpp:212:49: error: 'constrain' was not declared in this scope
   bitResolution = constrain(newResolution, 9, 12);

I feel like something obvious is missing, why these functions may be out of scope?

add #include "application.h" in DallasTemperature.h

1 Like

Thanks! I solved my problem.

I’d love to get some understanding what the “application.h” magic header contains. Do you know some reading material?

It’s something like #include Arduino.h i think so check that out. :wink:

@TomekC, application.h is an include of includes. It set the platform context for the C++ code, exactly like Arduino.h does. Your best bet to learn about it is to get into the Core/Photon open source code! :smile:

1 Like

This is what I started doing today :smile:

I need some time to get used to idea of compiling in the cloud instead of having local IDE with autocompletion based on header files. Spark Dev is close, but not exactly that.

I wonder if anyone managed to setup “proper” IDE for local development? At least to have comfortable editor - cloud-based flashing is nice idea anyway.

@TomekC, search around the Community and you will see some members use NetBeans, Eclipse or their own mix of Atom (what Particle DEV uses). On windows I use Notepad++ to edit and compile both locally and using CLI or DEV. :smile: