Thanks! It's working now. Here's my final code:
#include "max6675.h"
int ktcSO = 8;
int ktcCS1 = 9;
int ktcCS2 = 11;
int ktcCLK = 10;
MAX6675 ktc1(ktcCLK, ktcCS1, ktcSO);
MAX6675 ktc2(ktcCLK, ktcCS2, ktcSO);
int relayPin = 7;
void setup() {
/thermocouples/
Serial.begin(9600);
delay(500);
/relay/
pinMode(relayPin,OUTPUT);
digitalWrite(relayPin,HIGH);
}
void loop() {
/set temperature variables/
double T1 = ktc1.readCelsius();
double T2 = ktc2.readCelsius();
double dT = T1-T2;
/set relay state variable/
int state = digitalRead(relayPin);
Serial.print("T1: ");
Serial.print(T1);
Serial.print("°C");
Serial.print(" / T2: ");
Serial.print(T2);
Serial.println("°C");
Serial.println(T1-T2);
if (state == 0) {Serial.println("ON");}
else {Serial.println("OFF");}
/activate relay/
if ((dT>5) && (state==1)){
digitalWrite(relayPin, LOW);
}
else if ((dT<5) && (state==0)){
digitalWrite(relayPin, HIGH);
}
delay(500);
}
After uploading it, is the controller suppose to start working automatically as soon as I connect it to an adequate power source? I just tried doing that but it doesn't do anything.