# Max Temp LCD Print

``````/*
Thermistor on A0 and LCD I2C Screen. Displaying Single Temp Sensor on Screen.
*/

#include <LiquidCrystal_I2C.h>
#include <math.h>
#include <Wire.h>

/*
LCD Connections:
scl-a5, sda-a4, grd-grd, vcc-5v
*/

LiquidCrystal_I2C lcd(0x3F,20,4);  // set the LCD address to 0x3F for a 20 chars and 4 line display

void setup()
{
lcd.init();                      // initialize the lcd
lcd.backlight();
Serial.begin(9600);

}

double Temp;
// See http://en.wikipedia.org/wiki/Thermistor for explanation of formula
Temp = 1 / (1.652570365e-3 + (1.582194868e-4 * Temp) + (3.125375165e-7 * Temp * Temp * Temp));
Temp = Temp - 273.15;           // Convert Kelvin to Celcius
return Temp;
}

void printTemp(void) {
double fTemp;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temperature is:");
lcd.setCursor(0,1);
lcd.print(temp);
lcd.print(" C / ");
fTemp = (temp * 1.8) + 32.0;    // Convert to USA
lcd.print(fTemp);
lcd.print(" F");
if (fTemp > 200 && fTemp < 260) {
lcd.setCursor(0,3);
lcd.print("HOT");
}
double maxTemp = 0;
if(fTemp > maxTemp) maxTemp = fTemp; // display max temp
lcd.setCursor(0,4);
lcd.print (maxTemp);
}

void loop(void) {
printTemp();
delay(1000);
}
``````

When I run this code the Max Temp changes freely with fTemp.

What I am trying to do is to show the Max Temp and hold it on the screen.

I can't do the calculation of fTemp = (temp * 1.smiley-cool + 32.0; // Convert to USA

I don't seem to have a smiley-cool key on my PC,

lar3ry:
This ` double maxTemp = 0;` is your problem.