Help with digitalWrite

Ok here is my code

// which analog pin to connect
#define THERMISTORPIN A0
// which analog pin to connect
#define THERMISTORPIN1 A3
// resistance at 25 degrees C
#define THERMISTORNOMINAL  543.54      
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25   
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3905.6
// the value of the 'other' resistor
#define SERIESRESISTOR 560
//
const int voltPin = 4;

float denominator;

int resistor1 = 10000;

int resistor2 = 2530;
//
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); 



void setup()
{
  Serial.begin(9600);
 
    pinMode(13, OUTPUT);
  
    lcd.begin(16, 2);
    lcd.setCursor(0,0);
    lcd.print("O:");
    lcd.setCursor(5,0);
    lcd.print((char)223);
    lcd.setCursor(6,0);
    lcd.print("F");
    lcd.setCursor(9,0);
    lcd.print("W:   ");
    lcd.print((char)223);
    lcd.setCursor(15,0);
    lcd.print("F");
    lcd.setCursor(8,1);
    lcd.print("EGT:");
    lcd.setCursor(0,1);
    lcd.print("V:");
}
void loop()
{

 denominator = (float)resistor2 / (resistor1 + resistor2);
 float voltage;
  voltage = analogRead(voltPin);
  voltage = (voltage / 1024) * 5.0;
  voltage = voltage / denominator;
  
  lcd.setCursor(2,1);
  lcd.print(voltage);
  

float reading;
 
  reading = analogRead(THERMISTORPIN);
 
  // convert the value to resistance
  reading = (1023 / reading)  - 1;
  reading = SERIESRESISTOR / reading;
 
  float steinhart;
  steinhart = reading / THERMISTORNOMINAL;     // (R/Ro)
  steinhart = log(steinhart);                  // ln(R/Ro)
  steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
  steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
  steinhart = 1.0 / steinhart;                 // Invert
  steinhart -= 273.15;                         // convert to C
  steinhart = (((steinhart * 9) / 5) + 32);
  
  if (steinhart > 220) {
 digitalWrite(13, HIGH);
 }    
 else (digitalWrite(13, LOW));
 
  lcd.setCursor(2,0);
  lcd.print(steinhart,0);
 
  
  float Reading;
 
  Reading = analogRead(THERMISTORPIN1);
 
 
  // convert the value to resistance
  Reading = (1023 / Reading)  - 1;
  Reading = SERIESRESISTOR / Reading;
  
  float Steinhart;
  Steinhart = Reading / THERMISTORNOMINAL;     // (R/Ro)
  Steinhart = log(Steinhart);                  // ln(R/Ro)
  Steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
  Steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
  Steinhart = 1.0 / Steinhart;                 // Invert
  Steinhart -= 273.15;                         // convert to C
  Steinhart = (((Steinhart * 9) / 5) + 32);
  
   if (steinhart > 220) {
 digitalWrite(13, HIGH);
 }    
  else (digitalWrite(13, LOW));
  
  
  lcd.setCursor(11,0);
  lcd.print(Steinhart,0);
   
 
  
  int rawADC = analogRead(2); //stores ADC output of read voltage
float Vin = ( 5.0 * rawADC ) / 1024.0; // converts and stores ADC value to voltage seen by Atmel pin
float Vout = Vin - 1.25; //remove added Vref to get actual temp voltage from AD8495
float celsius = Vout / .005; //c
float egt = (((celsius * 9) / 5) + 32);//egt in f

if (egt > 1250)digitalWrite(13, HIGH);
 else (digitalWrite(13, LOW));
     

  lcd.setCursor(12,1);
  lcd.print(egt,0);
  
delay(1000);

}

now the problem is when it digitalWrite(13, HIGH) it dose not stay high but rather “blinks” on and off.

any help to keep it HIGH would be much appreciated.

You have

If condition Turn on Else turn off

Your code needs to be followed carefully to find when the condition is false.

Weedpharma

 if (steinhart > 220) {
 digitalWrite(13, HIGH);
 }    
 else (digitalWrite(13, LOW));

You seem to have this code at two places in loop()

Perhaps one turns it on and the other off?

Duplicating code like that is poor practice. If it needs to be called from two different places put it in a function.

...R