// 9 August 2023
// To change the board, go to json & in type line, replace with mega
// The DS18B20 simulation does not work with multiple sensors
// on a single 1-Wire bus unless naming each with its IP by a different code
// This demonstration shows three 1-Wire buses
// While project in run phase, you can click on any sensor & change
// parameters, like temperature, & readings will respond
// While project is in run phase, & getting any -127.00 reading means 
// that you have a wrong or missing connection
// 

#include <DallasTemperature.h>  // it includes OneWire as well

OneWire oneWire1(2);
DallasTemperature sensors1(&oneWire1);

OneWire oneWire2(3);
DallasTemperature sensors2(&oneWire2); 
OneWire oneWire3(4);
DallasTemperature sensors3(&oneWire3);


void setup() 
{
  
  Serial.begin(9600); //or Serial.begin(115200); this works also
  
 

  Serial.println("The sketch has started");

  sensors1.begin();
  sensors2.begin();
  sensors3.begin();
}

void loop() 
{
  sensors1.requestTemperatures();
  sensors2.requestTemperatures();
  sensors3.requestTemperatures();

  float tempC0 = sensors1.getTempCByIndex(0);
  float tempC1 = sensors2.getTempCByIndex(0);
  float tempC2 = sensors3.getTempCByIndex(0);
 
 
 
 
  Serial.print(tempC0);
  Serial.print(", ");
  Serial.print(tempC1);
  Serial.print(", ");
  Serial.print(tempC2);
  Serial.println();

  delay(2000);
}
Three 1-Wire buses
Three 1-Wire buses