DHT22 Temperature Relay Control

Hello,

First time post any a Forum if I am doing something wrong let me know. I am working with an Arduino Uno and a DHT22 Sensor. I am trying to get my code to turn on and off a relay at a given interval, I have tried using others code and reading about boolean’s but I don’t think that I fully understand the concept. Any help or nudge in the right direction would help thanks so much for your time and possibly patience in advance.

DHT22 Sensor (resistor on-chip )
Data Pin is attached to Pin 2 on board
Arduino
Pin 13 is connected to relay

//DHT22 setup
#include <DHT.h> //Include the DHT library.
#define dataPin 2 //Define the type data pin
#define DHTType DHT22 //Define the DHT sensor (DHT11, DHT21, or DHT22)
DHT dht = DHT(dataPin, DHTType);

//Heat and AC Ranges
int HeatOnTemp = 68;
int HeatOffTemp = 70;

int AcOnTemp = 75;
int AcOffTemp = 71;

//Pin Setup
int relayPinHeat = 13;
int relayPinAc = 12;

void setup() {
  Serial.begin(9600); //Start the serial interface on 9600
    dht.begin();   //Call the begin class in the dht object
    pinMode(relayPinHeat,OUTPUT);
    pinMode(relayPinAc,OUTPUT);
}

void loop() {
  delay(2000); 
  
  float h = dht.readHumidity(); //read the humidity from the sensor
  float t = dht.readTemperature(true);  // Read temperature as Celsius (the default), insert true as a parameter for fahrenheit  
  
  // Check for any errors, if there is, display error and restart.
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from the DHT sensor, check wiring.");
    return;
  }
   //Print out the humidity
  Serial.print("Humidity: ");
  Serial.print(h);
  
  //Print out the Temperature
  Serial.print("% || Temperature: ");
  Serial.print(t);
  Serial.print("°F ");
  Serial.println();

   if((t>=70)&&(13 == LOW)){  
   digitalWrite(13, HIGH);  
  }else if ((t<= 68)&&(13 == HIGH)){
    digitalWrite(13,LOW);
  }
}

I am assuming that I am trying to use my Boolean in an incorrect manner but i am not sure.

Again thanks for any help in advance

Nick

There is no Boolean in your code

My understanding of coding is even worse than I thought lol.

"if((t>=70)&&(13 == LOW))"

What is the name for the "&&","=="? I thought they were different forms of booleans.

For the name, take a look to “Comparison Operators” part of this page Arduino Reference - Arduino Reference

For the code, this code “13 == LOW” is wrong

you need to save the sate of relay connected to pin 13 to a variable and and compare this variable with LOW

You can refer to button toggles relay code

if( (t>=70) && (digitalRead(13) == LOW) )"

|| OR, as in: if this is true, OR that is true, then:
&& AND, as in: if this is true AND that is true, then:
| bit, digital OR: x = 0xAA OR 0x05; // result is x = 0xAF, bit operations
& bit, digital AND: x = 0xAF AND 0xF5; // result is x = 0xA5, bit operations