I am creating an enclosure and will have eight ds18b20 temp probes in different parts of the enclosure. Unfortuently due to having to assemble a lot of them I won’t have time to get the data address of each DS18b20 probe to connect them in series, so I will have to connect each probe to a different pin instead. However I am running into a problem of how to have multiple instances of the OneWire and DallasTemperature library run simultaneously. The code I am basing it from is the example from the Arduino Library for the DS18b20
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
// Pass our oneWire reference to Dallas Temperature.
// start serial port
Serial.println(“Dallas Temperature IC Control Library Demo”);
// Start up the library
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.print("Temperature for the device 1 (index 0) is: ");
Do I make multiple instances of OneWire and Sensors class and then call then separately or am I missing something else? Because of the time delay in reading the sensors and the need to have more accuracy I am hoping to first send all the commands to get the temperatures (sensor.requestTemperatures()) and then wait the amount of time needed and then collect the results (sensors.getTempCByIndex(0)) instead of looping through it for each sensor and having to wait 0.75 seconds per sensor. Thanks for your help, I am rather confused and don’t know how to proceed.