Displayng 2 error messages on a 16x02 display I am trying to display on a 16x02 LCD display 2 error codes. The error message is when one or both thermocouple wires get disconnected and the second error message is when the soldering iron temp goes higher than 432 C. I am using MAX6675 module.
The problem is that when I disconnect one thermocouple wire (the + or the -) sometimes the displayed message is &quot;Overheating !!!&quot; instead of &quot;No tc conn !!!&quot;.
Is there any way to display the correct error ?
heaterTemp = thermocouple.readCelsius();
  Input = heaterTemp - 100; 
   //No TC connection
  if (isnan(Input)) // No TC Connection
  {
    while (true) {
      digitalWrite(relay_pin, LOW);
      digitalWrite(11, LOW);
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print(&quot;NO TC CONN !!!&quot;);
      delay(1000);
    }
  }

  //Soldering Iron overtemperature
  if (Input &gt;= 432)
  {
    while (true) {
      digitalWrite(relay_pin, LOW);
      digitalWrite(11, LOW);
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print(&quot;OVERHEATING !!!&quot;);
      delay(1000);
    }
  }

Edit: I finally decided to use the same message for both errors - no TC connection and overheating. I used the code below:
heaterTemp = thermocouple.readCelsius();
  Input = 0.779828 * heaterTemp - 10.3427;
  if (isnan(heaterTemp) or Input &gt;= 432) // No TC Connection OR over-temperature
  {
    while (true) {
      digitalWrite(relay_pin, LOW);
      digitalWrite(11, LOW);
      for (int i=0; i&lt;=1; i++){
      lcd.clear();
      lcd.setCursor(0, i);
      lcd.write((byte)0);
      lcd.setCursor(1, i);
      lcd.write((byte)0);
      lcd.setCursor(5, i);
      lcd.print(&quot;ERROR!&quot;);
      lcd.setCursor(14, i);
      lcd.write((byte)0);
      lcd.setCursor(15, i);
      lcd.write((byte)0);
      delay(1000);
      }
    }
  }

and
byte thermometer[8] = //icon for termometer
{
  B00100,
  B01010,
  B01010,
  B01110,
  B01110,
  B11111,
  B11111,
  B01110
};

The code displays the thermometer symbol at the beginning and at the end of the row and the text (including the symbols) are moving from one to another row.
Now it is sufficiently to display a error message when the thermocouple gets disconnected or when the iron temperature goes above 432 *C.
I have also left the 2 while(true) loops because I need the program to stay in the loop and display the error message until I turn off the power and start again the soldering station.
I think before the disconnection is detected, it goes into overheating (maybe just for some milliseconds).
However, because there is a while (true) loop within the overheating part, it will never show the NO TC CONN error.
If you consider the NO TC CONN error to be higher than the OVERHEATING error, than check within the while loop of the OVERHEATING error also for the NO TC CONN error and display NO TC CONN when it is detected.