#include <LiquidCrystal.h>
#include <math.h>
// Initialize the LCD with the pins
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // RS, E, D4, D5, D6, D7
// Define the pin for the NTC sensor
const int ntcPin = 15; // GP15
// Constants for the NTC thermistor
const float BETA = 3950; // Beta coefficient
const float R0 = 10000; // Resistance at 25 degrees Celsius
void setup() {
// Start the LCD
lcd.begin(16, 2); // for a 16x2 LCD
lcd.print("Temp: ");
}
void loop() {
// Read the analog value from the NTC sensor
int ntcValue = analogRead(ntcPin);
// Convert the analog value to resistance
float resistance = (1023.0 / ntcValue) - 1.0;
resistance = R0 / resistance;
// Convert the resistance to temperature using the Beta parameter equation
float temperature = 1.0 / (log(resistance / R0) / BETA + 1.0 / 298.15) - 273.15;
// Print the temperature to the LCD
lcd.setCursor(6, 0);
lcd.print(temperature);
lcd.print(" C");
// Wait for a second before the next reading
delay(1000);
}