Hello All,
A quick question that Im hoping someone will have a quick answer for:
I have 12 ds18b20 on a one wire bus and use the the following snippets of code to get the addresses of each into an array and then every few seconds poll them.
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Sub to ping Temp probes and get the serial numbers in order of
//reading
void PingTemps()
{
// locate TEMP SENSORS devices on the ONEWIRE bus
Serial.print("Locating Temperature Devices...");
Serial.print("Found ");
Serial.print(sensors.getDeviceCount(), DEC);
Serial.println(" devices.");
if (!sensors.getAddress(T1, 0))
{Serial.println("Unable to find address for T1");}
else
{Serial.print("Temp#1:");
printAddress(T1);
Serial.println();}
//etc.
//etc.
}
Then in the loop:
//SUB to get temperatures
void getTemps()
{
sensors.requestTemperatures();
delay(50);
//CALL TO PRINT THE TEMP OF Tx
Serial1.print(sensors.getTempC(T1),1);Serial1.print(",");
Serial1.print(sensors.getTempC(T2),1);Serial1.print(",");
//etc.
//etc
}
My worry is that that if I (or someone else) replaces a sensor at some time in the future will the array be re-ordered? This would cause a mistake in where I think the temperature is being reported from.
So I'm wondering just how the sequence is determined ? I dont really want to re-compile the Arduino when changing a sensor out if one fails...or am I missing something simple?
Thanks all.