dht11 variable temp set point

Hello all here is my first post, not been good with forums and educate??? hoping this is in the correct spot and someone can help!! As of now I have a sketch based on virtubotix by joe dattilo, I have three dht11 sensors that are currently installed in the house upstairs basement and outside… they all regester temp and humidity well enough… well I want to change the outside dht11 to dht22… reason is the dht11 is only good for 0 degree c… and is currently reading -2 outside (wont go lower) due to rating but its more like -15 c… outside… What i’m doing is using greater than thresholds on upstairs and basement to start timer on plc to control furnace etc… works well less a few safety features later to come… the problem i have is I want to use the reading from the outside dht11 to control the thresholds for upstairs and basement I.e if outside temp increase then lower upstairs and basement setpoint and if outside gets colder then raise threshold… at least thats the plan with the code if have in place…

I dont really know code and have got lucky to this point thus far but here is the code less the plc data

#include <dht11.h>
/####################################################
Temperature and Humidity control unit by Joseph Dattilo
LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
GET UPDATES: https://www.virtuabotix.com
####################################################
/
dht11 DHT11;//change to dht22 DHT22; if using the dht22
//you will also need to change all instances of DHT11 to DHT22
byte fanrelaypin = 36;
byte heatrelaypin = 37;

dht11 DHT12;//change to dht22 DHT22; if using the dht22
//you will also need to change all instances of DHT11 to DHT22
byte fan2relaypin = 38;
byte heat2relaypin = 39;

dht11 DHT13;//change to dht22 DHT22; if using the dht22
//you will also need to change all instances of DHT11 to DHT22
byte fan3relaypin = 40;
byte heat3relaypin = 41;

void setup()
{
DHT11.attach(3);//Change upstairs
DHT12.attach(6);//Change outside
DHT13.attach(9);//Change basement

Serial.begin(9600);
Serial.println(“Virtuabotix DHT11 FAN & Heater CONTROL”);
pinMode(fanrelaypin, OUTPUT);
digitalWrite(fanrelaypin, LOW);//turn off the relay
pinMode(heatrelaypin, OUTPUT);
digitalWrite(heatrelaypin, LOW);//turn off the relay
pinMode(fan2relaypin, OUTPUT);
digitalWrite(fan2relaypin, LOW);//turn off the relay
pinMode(heat2relaypin, OUTPUT);
digitalWrite(heat2relaypin, LOW);//turn off the relay
pinMode(fan3relaypin, OUTPUT);
digitalWrite(fan3relaypin, LOW);//turn off the relay
pinMode(heat3relaypin, OUTPUT);
digitalWrite(heat3relaypin, LOW);//turn off the relay
}
void loop()
{

Serial.println("\n");
int chk = DHT11.read();
switch (chk)

Serial.println("\n");
int chk2 = DHT12.read();
switch (chk2)

Serial.println("\n");
int chk3 = DHT13.read();
switch (chk3)

{case 0: Serial.println(“OK”); break;
case -1: Serial.println(“Checksum error”); break;
case -2: Serial.println(“Time out error”); break;
default: Serial.println(“Unknown error”); break;
}
Serial.print("Humidity UPSTAIRS(%): "); Serial.println((float)DHT11.humidity, DEC); Serial.print("UPSTAIRS TEMP (C): ");Serial.println(DHT11.temperature, DEC);

Serial.print("Humidity OUTSIDE(%): "); Serial.println((float)DHT12.humidity, DEC); Serial.print("OUTSIDE TEMP (C): ");Serial.println(DHT12.temperature -3, DEC);

Serial.print("Humidity BASEMENT(%): "); Serial.println((float)DHT13.humidity, DEC); Serial.print("BASEMENT TEMP (C): ");Serial.println(DHT13.temperature , DEC);

if(DHT11.humidity > 59)//change % to match your threshold.
if(DHT12.humidity > 35)//change % to match your threshold.
if(DHT13.humidity > 35)//change % to match your threshold.
{
digitalWrite(fanrelaypin, HIGH);//turn on the fan
digitalWrite(fan2relaypin, HIGH);//turn on the fan
digitalWrite(fan3relaypin, HIGH);//turn on the fan
}
else
{
digitalWrite(fanrelaypin, LOW);
digitalWrite(fan2relaypin, LOW);
digitalWrite(fan3relaypin, LOW);
}

if(DHT11.temperature < 32)//change to match your threshold in C.
{ digitalWrite(heatrelaypin, HIGH);//turn on the heater
}else
digitalWrite(heatrelaypin, LOW);
delay(2000);

if(DHT12.temperature > 4)//change to match your threshold in C.
digitalWrite(heat2relaypin, HIGH);//turn on the heater }
else
digitalWrite(heat2relaypin, LOW);
delay(2000);

if(DHT13.temperature < 28)//change to match your threshold in C.
digitalWrite(heat3relaypin, HIGH);//turn on the heater }
else
digitalWrite(heat3relaypin, LOW);
delay(2000);
}

I guess I should say as of now i change threshold in sketch and then download to mega 2560.. in the long run i want to use lcd and possible a few buttons.. but as of now i just want to do, for every degree below dht12.tempurature sensor threshold add the difference to the thresholds for basement and upstairs..which just allows the furnace to run a bit longer...and if outside temp increased subtract the difference to shut furnace off sooner!! I have tried a bit of the arithmatic but suck and get errors and have not been able to get passed what im doing wrong??

Randomly slopping curly braces in the code is NOT useful.

EVERY if statement should have ONE open curly brace and ONE close curly brace. The braces should be on lines BY THEMSELVES. You should use Tools + Auto Format EVERY time you are too lazy to properly indent the code.

You should get rid of the useless comments.

You should give your dht11 instances MEANINGFUL names. DHT11, DHT12, and DHT13 are NOT a meaningful names. basementThermometer, upstairsThermometer, and outsideThermometer ARE.

With meaningful names, it is easy to see what the code is doing.