I would like to display the temp of two DS18B20 temp sensors on an i2c LCD
I know that each sensor has its own address and can have more that 1 sensor on one arduino pin
I found this sketch but I cant figure out how the sketch uses the sensors without there address
//I2C bus support
#include <Wire.h>
//I2C
#include <LiquidCrystal_I2C.h>
//OneWire bus suport
#include <OneWire.h>
//DS18B20 temperature sensor support
#include <DallasTemperature.h>
//DS18B20 sensor pin
#define ONE_WIRE_BUS 8
// 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);
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init();
lcd.backlight(); //Turns backlight on
sensors.begin();
}
void loop()
{
sensors.requestTemperatures();
//Read first sensor
float temp = sensors.getTempCByIndex(0);
//Print first sensor results
lcd.setCursor (0, 0 );
lcd.print("T1: ");
lcd.print(temp);
lcd.print(" ");
//Read second sensor
temp = sensors.getTempCByIndex(1);
//Print second sensor result
lcd.setCursor (0, 1 );
lcd.print("T2: ");
lcd.print(temp);
lcd.print(" ");
//Wait 0.1 sec
delay(100);
}