#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
const int SENSOR_PIN = 13;
const int BUTTON_PIN = 2;
OneWire oneWire(SENSOR_PIN);
DallasTemperature sensors(&oneWire);
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
sensors.begin();
lcd.init();
lcd.backlight();
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
void loop() {
if (digitalRead(BUTTON_PIN) == LOW) {
sensors.requestTemperatures();
float tempCelsius = 32.0; // Set to 32 degrees Celsius
float tempFahrenheit = tempCelsius * 9 / 5 + 32;
lcd.clear();
lcd.print(tempCelsius, 1);
lcd.setCursor(6, 0);
lcd.print("C ");
lcd.setCursor(0, 1);
lcd.print(tempFahrenheit, 1);
lcd.setCursor(6, 1);
lcd.print("F ");
delay(1000); // Add a small delay to avoid rapid button presses
}
}