/*ThermoDisplay*/
/*Here, we use the DS18B20, which is a digital sensor, whereas in hands-on projects,
we use the LM35, which is an analog sensor.*/
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
#define ONE_WIRE_BUS 2 // Pin for DS18B20 data
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass the oneWire reference to DallasTemperature library
DallasTemperature sensors(&oneWire);
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
int temp;
float tempc;
float tempf;
void setup()
{
Serial.begin(9600);
// Initialize the DS18B20 sensor
sensors.begin();
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Temp");
}
void loop()
{
// Request temperature readings
sensors.requestTemperatures();
// Read temperature in Celsius
float tempc = sensors.getTempCByIndex(0);
// Check if the temperature is valid
if (tempc != -127.00) {
Serial.print("Temperature: ");
Serial.print(tempc);
Serial.println(" °C");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temp in C = ");
lcd.print(tempc);
lcd.setCursor(0,1);
tempf=((tempc*9)/5+32);
lcd.print("Temp in F = ");
lcd.print(tempf);
} else {
Serial.println("Error: Unable to read temperature data");
}
delay(1000); // Adjust delay as needed
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
lcd1:VSS
lcd1:VDD
lcd1:V0
lcd1:RS
lcd1:RW
lcd1:E
lcd1:D0
lcd1:D1
lcd1:D2
lcd1:D3
lcd1:D4
lcd1:D5
lcd1:D6
lcd1:D7
lcd1:A
lcd1:K
pot1:GND
pot1:SIG
pot1:VCC
r1:1
r1:2
temp1:GND
temp1:DQ
temp1:VCC