I am trying to setup an Arduino with two onewire busses attached to it using the DallasTemperature library. Below is some sample code from the Dallastemperature library of setting up 2 ds18b20 sensors on one bus. I cannot figure out how to modify this code to add another onewire bus . Everything I try to add another bus will not compile.
I cannot find an example on the internet . Can some kind soul help me with this perplexing(to me) problem? Maybe what I am trying to do isnt even possible?
Thanks
Frank
#include <OneWire.h>
#include <DallasTemperature.h>
// 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)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
// Start up the library
sensors.begin();
}
void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
Serial.print("Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");
Serial.print("Temperature for the device 1 (index 0) is: ");
Serial.println(sensors.getTempFByIndex(0));
delay(2000);
Serial.print("Temperature for the device 2 (index 1) is: ");
Serial.println(sensors.getTempFByIndex(1));
delay(2000);
}