-
Notifications
You must be signed in to change notification settings - Fork 2
SetDeviceResolution()
This function set the resolution of DeviceIndex to a value of 9, 10, 11 or 12; any other values for Resolution are adjusted to 12 bits. While each device can have a different setting, the public variable ConversionMillis is used to determine how long to wait, if necessary, for conversions to complete. Since this is a single value and set in this function, the last call will determine how long waits are done. This means if one thermometer is set to 12 and then another is set to 9, the library assumes that only 94ms need to elapse between a DeviceStartConvert() call and the subsequent ReadDeviceTemp() . If this is done on the first device before it 750ms conversion is finished an old value will be returned.
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
uint8_t Resolution = 11; // set to 11 bits
for (uint8_t i=0;i<thermometers;i++)
ds.SetDeviceResolution(i,Resolution);
for (uint8_t i=0;i<thermometers;i++) {
Serial.print("Device ");
Serial.print(i);
Serial.print(" has "):
Serial.print(ds.GetDeviceResolution(i));
Serial.println(" bits of precision set.");
} // of for-next loop
Overview
Installation
Class Instantiation
ScanForDevices()
ReadDeviceTemp()
DeviceStartConvert()
GetDeviceResolution()
SetDeviceResolution()
Calibrate()
GetDeviceCalibration()
SetDeviceCalibration()
GetDeviceROM()
crc8()
MinTemperature()
MaxTemperature()
AvgTemperature()
StdDevTemperature()