I have no trouble talking to a DS18B20 using the standard wire library and defining the one-wire pin as D4 (on Nano and Uno). But neither one of them will work with other digital pins (D1, D12 for example). I'm under the impression that the only code line that needs to be changed in order to change the bus address is the following:
// Data wire is plugged into pin 4 on the Arduino
#define ONE_WIRE_BUS 4
Is there something else I need to do to use a different pin?
void gettemps() {
float intemp_a ;
float outtemp_a ;
float tanktemp_a ;
float refertemp_a ;
sensors.requestTemperatures(); // Send the command to get temperatures
intemp_a = sensors.getTempCByIndex(0) ;
outtemp_a = sensors.getTempCByIndex(1) ;
tanktemp_a = sensors.getTempCByIndex(2) ;
refertemp_a = sensors.getTempCByIndex(3) ;
intempf = DallasTemperature::toFahrenheit(intemp_a) ;
outtempf = DallasTemperature::toFahrenheit(outtemp_a) ;
tanktempf = DallasTemperature::toFahrenheit(tanktemp_a) ;
refertempf = DallasTemperature::toFahrenheit(refertemp_a) ;
}
If I connect one DS1820 to the one-wire pin, the function lcd.print(intempf) gives "-196" and lcd.print(outtempf) gives "185". When the single DS1820 is disconnected, both print functions give "32". When the sensor reads are working, one sensor seems to populate all four indexes with the same value, so this differing data is further confusing the issue.
I may have stumbled on the problem. I was plugging the DS1820s in "hot." I'm assuming this bypassed the startup interrogation for IDs. It appeared that this worked on at least one breadboard, but it may be because I was also modifying code and every upload caused a reset, which led me to believe these sensors could be plugged in hot.
Dr Quark