k type thermal coupler

morning all, trying to get a my pressure sterilizer to maintain a specific temp with a thermo coupler and a uno how ever i can read them temp fine it prints it on the display but the control logic is not working at all, it switches it on but bot of any aqdvice would be great

#include <max6675.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
//temp control points
#define SETPOINT 114.0
#define DEADBAND 0.5
#define COOKER 10
#define ON true
#define OFF false

int thermoDO = 4;
int thermoCS = 5;
int thermoCLK = 6;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
int vccPin = 3;
int gndPin = 2;

LiquidCrystal_I2C lcd(0X27, 2, 1, 0, 4, 5, 6, 7);

// make a cute degree symbol
uint8_t degree[8]  = {140, 146, 146, 140, 128, 128, 128, 128};

void setup() {
  pinMode(COOKER, OUTPUT);
  digitalWrite (COOKER, OFF);


  lcd.begin(16, 2);
  lcd.setBacklightPin(3, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.createChar(0, degree);

  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  delay (1000);
  float t = thermocouple.readCelsius();
  lcd.setCursor(0, 0);
  lcd.print ("COOKER");
  lcd.setCursor(7, 0);
  lcd.print(t, 2);
  lcd.setCursor(15, 0);
  lcd.print("C");

  // now we begin with the control logic
  if (digitalRead(COOKER) == ON)
  {
    if ( t > SETPOINT + DEADBAND)
    {
      digitalWrite(COOKER, OFF);
    }
    else
    {
      if (t < SETPOINT - DEADBAND)
        digitalWrite (COOKER, ON);


    }
  }
}

You mean a thermocouple.

What’s this?:

int vccPin = 3;
int gndPin = 2;

Also the logic here is wrong:

  // now we begin with the control logic
  if (digitalRead(COOKER) == ON)
  {
    if ( t > SETPOINT + DEADBAND)
    {
      digitalWrite(COOKER, OFF);
    }
    else
    {
      if (t < SETPOINT - DEADBAND)
        digitalWrite (COOKER, ON);


    }
  }

Not hard to figure out why if you look at what happens to COOKER in setup()

yes i do mean thermocouple and this was part of the example code, can you please explain why the control logic is wrong

How does the "control logic" handle the case if the cooker is OFF? Carefully check all the curly brackets.

Where DID you find this example code?

I don't know if true or false equates to HIGH or LOW. Try this too:

Syntax digitalWrite(pin, value)

Parameters pin: the Arduino pin number. value: HIGH or LOW.