LCD Not printing with certain code

This is my first forum post,
I have the GDM1602K LCD (16x2 character display) from sparkfun. I am attempting to integrate it into my space heater project running off of my Arduino UNO. The hardware attached to the Arduino is a 125V 10A 8 channel relay block, a TMP36 temp sensor, and the GDM1602K LCD.

With a test code, or the hello world example, the LCD prints correctly. But with my main space heater code, the LCD does not print.

Any input on why this could be happening would be great!

--With the following code, the LCD works correctly.

#include <LiquidCrystal.h>
LiquidCrystal lcd(5, 4, 3, 2, 1, 0);

void setup() 
{  lcd.begin(16, 2);
  lcd.print("Set Temp:");
  lcd.setCursor(0, 1);
  lcd.print("Air Temp: ");
}

void loop() {
  lcd.setCursor(0, 1);
  lcd.print("Air Temp:HOT");
  delay(2000);
  lcd.setCursor(0, 1);
  lcd.print("Air Temp:COLD");
  delay(2000);
  lcd.clear();
}

-- With my code actual heater code the LCD does not print at all.

  // include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(5, 4, 3, 2, 1, 0);

float setTemp;      //variable for temp set by user 
float airTemp;      //variable for outside air temp
float setTemp2;
float setTemp5;
float setTemp7;
float avgReading;
int readings[numReadings];      // the readings from the analog input
int readIndex = 0;              // the index of the current reading
int total = 0;                  // the running total
int averageTemp = 0;            // the average temp
const int numReadings = 10;
int heater = 12;     //heater element relay
int powerSupply = 11;//power supply relay
int pump = 10;       //Pump relay 
int fan1Relay = 9;  //fan relay
int fan2Relay = 8; //fan relay
int alarm = 7;     //red LED and annoying noise
int fanSpeed = 6; //fan high/low speed control
int reading;
int count2;
int count3;
int lcdCount;

void setup()
{ 
Serial.begin(9600);
pinMode(heater,OUTPUT);      
pinMode(powerSupply,OUTPUT);
pinMode(pump,OUTPUT);
pinMode(fan1Relay,OUTPUT);
pinMode(fan2Relay,OUTPUT);
pinMode(alarm,OUTPUT);
pinMode(fanSpeed,OUTPUT);
digitalWrite(heater,HIGH);
digitalWrite(powerSupply,HIGH);
digitalWrite(pump,HIGH);
digitalWrite(fan1Relay,HIGH);
digitalWrite(fan2Relay,HIGH);
digitalWrite(alarm,HIGH);
digitalWrite(fanSpeed,HIGH);
for (int thisReading = 0; thisReading < numReadings; thisReading++)
 { readings[thisReading] = 0; }
preHeat();
setTemp = .85;
lcd.clear();
lcd.begin(16, 2); 
}

void loop()
{ reading = analogRead(0);                 // Averaging program to smooth temp data 
  
  readings[readIndex] = reading;          // read from the sensor
  total = total + readings[readIndex];   // add the reading to the total:
  
  readIndex = readIndex + 1;

  if (readIndex >= numReadings) {
    readIndex = 0;
    avgReading = total / numReadings;   // calculate the average:
  }

  airTemp = (avgReading * .00488);
  setTemp2 = setTemp + .02;
  setTemp5 = setTemp + .05;
  setTemp7 = setTemp + .07;
	
  Serial.println (reading);
  Serial.println (airTemp);
  Serial.println (setTemp);
  

    lcd.setCursor(0, 0);
    lcd.print("HELLO");  // Print a message to the LCD.
    lcd.setCursor(0, 1);
    lcd.print("DAN!"); // Print a message to the LCD. 
  	
  
  
  
  if (airTemp < setTemp)   //Turn on heat, pump, and max airflow 
  { heat1();
  }

    if ((airTemp < setTemp) && (airTemp > setTemp2))
    { count2 = count2 + 1;
    	if (count3 = 10000)
     	{ heat2();
  		  count2 = 0;
     	}
    }
 
  if ((airTemp > setTemp2) && (airTemp < setTemp5)) //Reduce airflow 
  { heat2();
  }
  	
  	if ((airTemp < setTemp5) && (airTemp > setTemp7))
    { count3 = count3 + 1;
      if (count3 = 10000)
      { heat3();
     	count3 = 0;
      }
    }
  	
  if (airTemp > setTemp7)  //shut off  airflow 
  { heat3();
  }
}

void preHeat()
{ digitalWrite(heater,LOW);
  delay(5000);
}	

void heat1()
{   digitalWrite(powerSupply,LOW);
  	digitalWrite(pump,LOW);
  	digitalWrite(fan1Relay,LOW);
  	digitalWrite(fan2Relay,LOW);
  	digitalWrite(fanSpeed,LOW);
  	Serial.println("heat1");
}
void heat2()
{   digitalWrite(powerSupply,LOW);
  	digitalWrite(pump,LOW);
  	digitalWrite(fan1Relay,LOW);
  	digitalWrite(fan2Relay,LOW);
  	digitalWrite(fanSpeed,HIGH);
  	Serial.println("heat2");
}

void heat3()
{   digitalWrite(powerSupply,HIGH);
  	digitalWrite(pump,HIGH);
  	digitalWrite(fan1Relay,HIGH);
  	digitalWrite(fan2Relay,HIGH);
  	digitalWrite(fanSpeed,HIGH);
   	Serial.println("heat3");
}
void off() 
{ digitalWrite(heater,HIGH);
  digitalWrite(powerSupply,HIGH);
  digitalWrite(pump,HIGH);
  digitalWrite(alarm,LOW);
}

Why are you putting

lcd.clear();

before

lcd.begin(16, 2);

and why are you defining variables as floats?

I put

 lcd.clear();

before that because if I ran a different LCD code before i ran my space Heater code, the LCD would not clear and would then start displaying weird Japanese characters over what was previously displayed.

My teacher told me to define those as floats because the values would be changing as the program ran, is to define those as floats considered incorrect?

The point is that you cannot sensibly clear the display before you have initialised it with lcd.begin(). That is the only blunder I can see that might actually prevent it from operating.

"because the values would be changing as the program ran" is gobbledegook. You use floats if you really need a floating point value, otherwise ints or longs are much easier to work with. There are ways of displaying an int or long as a fixed point value in hundredths or thousandths.

It's not critical just easier and much faster if that is relevant, to use the integer maths.

(off topic)
TIP: press CTRL-T before posting code - it does an auto format

floats is not incorrect by definition, but the are LCD libraries that do not support them.
You can write a small test sketch to verify this.

LiquidCrystal lcd(5, 4, 3, 2, 1, 0);

You have serial output on pins 0 and 1 of the UNO. Move your lcd to some other pins and change the constructor to match.

This has fixed the problem, thanks!!! I had to change my 0 and 1 pins. I changed the to A5 and A4. Thanks for the help everyone! and cattledog for solving the problem!

DanBurke:
This has fixed the problem, thanks!!! I had to change my 0 and 1 pins. I changed the to A5 and A4.

That is probably a bad choice in general, as A5 and A4 on a UNO/ Nano/ Pro Mini are the I2C interface.