DallasTemperature.h library problems

Hello all,

As I’m trying to read multiple DS18B20 sensors via onewire, I’m trying to use a sketch which uses the DallasTemperature.h library.
Trying to download the thing from http://www.milesburton.com/?title=Dallas_Temperature_Control_Library but some wiki-user changed all the download links to downloadranking.com effectively deleting the file from the wiki.

I’ve looked up the library and downloaded it, installed it and tried to use it, here’s my sketch:

/* YourDuino Multiple DS18B20 Temperature Sensors on 1 wire
DS18B20 Pinout (Left to Right, pins down, flat side toward you)

  • Left = Ground
  • Center = Signal (Pin 2): (with 3.3K to 4.7K resistor to +5 or 3.3 )
  • Right = +5 or +3.3 V

Questions: terry@yourduino.com
V1.01 01/17/2013 …based on examples from Rik Kretzinger

/-----( Import needed libraries )-----/
// Get 1-wire Library here: http://www.pjrc.com/teensy/td_libs_OneWire.html
#include <OneWire.h>

//Get DallasTemperature Library here: http://milesburton.com/Main_Page?title=Dallas_Temperature_Control_Library
#include <DallasTemperature.h>

/-----( Declare Constants and Pin Numbers )-----/
#define ONE_WIRE_BUS_PIN 2

/-----( Declare objects )-----/
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS_PIN);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

/-----( Declare Variables )-----/
// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

DeviceAddress Probe01 = { 0x28, 0xE5, 0xC7, 0xD0, 0x04, 0x00, 0x00, 0x30 };
DeviceAddress Probe02 = { 0x28, 0x9D, 0xFF, 0xCF, 0x04, 0x00, 0x00, 0x11 };
//DeviceAddress Probe03 = { 0x28, 0x4D, 0x8D, 0x40, 0x04, 0x00, 0x00, 0x78 };
//DeviceAddress Probe04 = { 0x28, 0x9A, 0x80, 0x40, 0x04, 0x00, 0x00, 0xD5 };
//DeviceAddress Probe05 = { 0x28, 0xE1, 0xC7, 0x40, 0x04, 0x00, 0x00, 0x0D };

void setup() /****** SETUP: RUNS ONCE ******/
// start serial port to show results
Serial.print("Initializing Temperature Control Library Version ");

// Initialize the Temperature measurement library

// set the resolution to 10 bit (Can be 9 to 12 bits … lower is faster)
sensors.setResolution(Probe01, 12);
sensors.setResolution(Probe02, 12);
//sensors.setResolution(Probe03, 10);
//sensors.setResolution(Probe04, 10);
//sensors.setResolution(Probe05, 10);

}//–(end setup )—

void loop() /****** LOOP: RUNS CONSTANTLY ******/
Serial.print("Number of Devices found on bus = ");
Serial.print("Getting temperatures… ");

// Command all devices on bus to read temperature

Serial.print("Probe 01 temperature is: ");

Serial.print("Probe 02 temperature is: ");

//Serial.print("Probe 03 temperature is: ");

//Serial.print("Probe 04 temperature is: ");

//Serial.print("Probe 05 temperature is: ");

}//–(end main loop )—

/-----( Declare User-written Functions )-----/
void printTemperature(DeviceAddress deviceAddress)

float tempC = sensors.getTempC(deviceAddress);

if (tempC == -127.00)
Serial.print("Error getting temperature ");
Serial.print("C: “);
Serial.print(” F: ");
}// End printTemperature
//( THE END )**

But it won’t compile, I get the following error messages:

sketch_sep12a:26: error: variable or field ‘printTemperature’ declared void
sketch_sep12a:26: error: ‘DeviceAddress’ was not declared in this scope
sketch_sep12a:26: error: no matching function for call to ‘DallasTemperature::DallasTemperature(OneWire*)’
G:\Apps\Arduino\Sketches\libraries\DallasTemperature/DallasTemperature.h:63: note: candidates are: DallasTemperature::DallasTemperature(StratBase*)
G:\Apps\Arduino\Sketches\libraries\DallasTemperature/DallasTemperature.h:38: note: DallasTemperature::DallasTemperature(const DallasTemperature&)
sketch_sep12a:33: error: ‘DeviceAddress’ does not name a type
sketch_sep12a:34: error: ‘DeviceAddress’ does not name a type
sketch_sep12a.ino: In function ‘void setup()’:
sketch_sep12a:45: error: ‘DALLASTEMPLIBVERSION’ was not declared in this scope
sketch_sep12a:48: error: no matching function for call to ‘DallasTemperature::begin()’
G:\Apps\Arduino\Sketches\libraries\DallasTemperature/DallasTemperature.h:69: note: candidates are: void DallasTemperature::begin(uint8_t)
G:\Apps\Arduino\Sketches\libraries\DallasTemperature/DallasTemperature.h:78: note: void DallasTemperature::begin(NewOneWire&)
sketch_sep12a:51: error: ‘class DallasTemperature’ has no member named ‘setResolution’
sketch_sep12a:51: error: ‘Probe01’ was not declared in this scope
sketch_sep12a:52: error: ‘class DallasTemperature’ has no member named ‘setResolution’
sketch_sep12a:52: error: ‘Probe02’ was not declared in this scope
sketch_sep12a.ino: In function ‘void loop()’:
sketch_sep12a:64: error: ‘class DallasTemperature’ has no member named ‘getDeviceCount’
sketch_sep12a:69: error: ‘class DallasTemperature’ has no member named ‘requestTemperatures’
sketch_sep12a:72: error: ‘Probe01’ was not declared in this scope
sketch_sep12a:72: error: ‘printTemperature’ was not declared in this scope
sketch_sep12a:76: error: ‘Probe02’ was not declared in this scope
sketch_sep12a.ino: At global scope:
sketch_sep12a:95: error: variable or field ‘printTemperature’ declared void
sketch_sep12a:95: error: ‘DeviceAddress’ was not declared in this scope

Can anyone point me toward the correct library or see something I obviously missed?

Ditch everything you've got and go here


I had nothing but grief with Miles Burton.

Thanks, I switched to hacktronics and now it all works.

I have not been able to access the Dallas Temp.sensor library ( April2014) and wonder if this problem has been worked around. Unzipping with Windows just leads to a low-res PDF icon. Is there a copyright issue here? john :(

No. Try the link in reply #1 and see how you go.