MAX6675 library

Hi,

I managed to set and Arduino Uno with two Thermocouples and one Relay. My intention is to activate the relay once T1 is 5°C over T2.

In order to make the code cleaner, I want to create variables T1 and T2 at the beginning of each loop so I can call them after without having to use the readCelsius function each time.

This is my code so far:

/thermocouples/

include "max6675.h"

int ktcSO = 8; int ktcCS = 9; int ktcCS2 = 11; int ktcCLK = 10;

MAX6675 ktc(ktcCLK, ktcCS, ktcSO); MAX6675 ktc2(ktcCLK, ktcCS2, ktcSO);

void setup() {

/thermocouples/ Serial.begin(9600); delay(500);

}

void loop() {

/thermocouples/ double T1 = ktc.readCelsius; double T2 = ktc2.readCelsius; Serial.print("Thermocouple 1: "); Serial.print(T1); Serial.print("°C"); Serial.print(" / Thermocouple 2: "); Serial.println(T2); Serial.print("°C");

delay(500);

}

I forgot to say that I'm getting the following error with that code:

sketch_nov15a:28: error: cannot convert 'MAX6675::readCelsius' from type 'double (MAX6675::)()' to type 'double'

double T1 = ktc.readCelsius;

^

sketch_nov15a:29: error: cannot convert 'MAX6675::readCelsius' from type 'double (MAX6675::)()' to type 'double'

double T2 = ktc2.readCelsius;

double T1 = ktc.readCelsius;

When you call a function you have to put the parenthesis there.

double T1 = ktc.readCelsius();

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.