#include <LiquidCrystal.h>
// Initialize LCD
const int rs =5, en =18, d4 =4, d5 =0, d6 =2, d7=15;
LiquidCrystal lcd(5, 17, 18, 4, 0, 2, 15);
// Define LDR and LED pin
const int thermometerPin = 25;//represented by a potentiometer
int LED = 21;
// Define threshold value
const int Threshold = 813 ; // declare in maximum temperature(kelvins)
void setup() {
int tempValue = analogRead(thermometerPin);//read themometer
const int Threshold =813 ;
// Set up the LCD
Serial.begin(9600);
lcd.begin(16, 2);
lcd.clear();
// Set LED pin as output
pinMode(25, INPUT);
pinMode(21, OUTPUT);
// Print initial messages on LCD
lcd.setCursor(0, 0);
lcd.print("THERMO(K):");
lcd.setCursor(0, 1);
lcd.print("");
lcd.setCursor(0, 1);
lcd.print("Threshold(k): 813 ");
lcd.setCursor(0, 2);
lcd.print("ThermoMeter(k): "); //set value read by thermometr @ line 3
lcd.setCursor(8,3);
lcd.setCursor(0, 3);
lcd.print("SYSTEM:");//set stystem reort @ line 4
}
void loop() {
// Read the LDR value
int tempValue = analogRead(thermometerPin);//read themometer
int mappedValeu = map(thermometerPin,0,1023,0,900);//thermometer value kelvins
int ThermoMeter = analogRead(thermometerPin);
lcd.setCursor(16,2);
lcd.print(tempValue);
// Display LDR value on LCD
// Check if light intensity falls below threshold
if (tempValue > Threshold) {
// Turn on LED
digitalWrite(LED, HIGH);
lcd.setCursor(7, 4);
lcd.print("STOP");
} else {
// Turn off LED
digitalWrite(LED, LOW);
lcd.setCursor(7, 4);
lcd.print("SAFE");
}
delay(500); // Adjust delay time as needed
}
//LINK REFERENCE https://www.youtube.com/watch?v=gNEYa1qNdX8