Skip to content

GetDeviceCalibration()

Arnd edited this page Dec 12, 2020 · 2 revisions

GetDeviceCalibration(deviceNumber)

If the deviceNumber DS-Family thermometer has been calibrated by using the Calibrate() function or explicitly set using the SetDeviceCalibration() function then a call to this function will return a signed 8-bit integer representing the number 0.0625°C units of offset that are applied to temperature readings using ReadDeviceTemp().

A value of 0 is returned if the device is not calibrated.


Example:

const uint8_t ONE_WIRE_PIN = 8;             // 1-Wire microLAN pin
DSFamily_Class ds(ONE_WIRE_PIN);            // Instantiate
uint8_t thermometers = ds.ScanForDevices(); // find all devices
for (uint8_t i=0;i<thermometers;i++) {
 Serial.print("Thermometer ");
 Serial.print(i);
 Serial.print(" has a calibration offset of ");
 Serial.print(ds.GetDeviceCalibration(i));
 Serial.print(" units, or ");
 Serial.print(ds.GetDeviceCalibration(i)*0.0625,3);
 Serial.println("C.");
} // of for-next each thermometer