//2024_03_16_V2_Nano_DB18S20_LCD 

//Versão individualizada só com DB18S20 + LCD para depois criar as funções

//######  Funcionou  #######

#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>

OneWire oneWire(8);
DallasTemperature sensor(&oneWire);
LiquidCrystal lcd (2, 3, 4, 5, 6, 7);

void setup() {
  Serial.begin(9600);
  sensor.begin();
  lcd.begin(16,2);
}

void loop() {

  sensor.requestTemperatures();
  Serial.print("Temperature DB18S20 é: ");
  delay(10);
  Serial.println(sensor.getTempCByIndex(0));
  delay(1000);

  lcd.setCursor(0,0);
  lcd.print("T1(C)");
  lcd.setCursor(0,1);
  lcd.print(sensor.getTempCByIndex(0));

  lcd.setCursor(6,0);
  lcd.print("T2(C)");
  lcd.setCursor(6,1);

  lcd.setCursor(12,0);
  lcd.print("UR-%");
  lcd.setCursor(12,1);
}
GND5VSDASCLSQWRTCDS1307+