Hello All,
I am using Corey Fowler's Library for the MAX31855*.
This works. I call the function from da loop.
#include <MAX31855.h>
#include <TimerOne.h>
const byte scale = 0; // 0 is Celsius/Centigrade, ~80µs. 1 is Kelvin, ~108µs. 2 is Fahrenheit ~100µs. 3 is Rankine, ~100µs.
byte error;
byte channel = 0;
double external;
double internal;
int muxdelay=130;
MAX31855 TCM(9);
void setup(){
TCM.begin();
Serial.begin(115200);
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
// Timer1.initialize(100000);
// Timer1.attachInterrupt(read_and_write);
}
void loop(){
read_and_write();
}
void read_and_write(){
TCM.setMUX(channel, muxdelay); // Set MUX channel, enable MUX, and start MAX31855 conversion process.
TCM.getTemp(external, internal, scale, error); // Read MAX31855
Serial.print('
But if I call it from TimerOne interrupt. It does not work.
#include <MAX31855.h>
#include <TimerOne.h>
const byte scale = 0; // 0 is Celsius/Centigrade, ~80µs. 1 is Kelvin, ~108µs. 2 is Fahrenheit ~100µs. 3 is Rankine, ~100µs.
byte error;
byte channel = 0;
double external;
double internal;
int muxdelay=130;
MAX31855 TCM(9);
void setup(){
TCM.begin();
Serial.begin(115200);
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
Timer1.initialize(100000);
Timer1.attachInterrupt(read_and_write);
}
void loop(){
//read_and_write();
}
void read_and_write(){
TCM.setMUX(channel, muxdelay); // Set MUX channel, enable MUX, and start MAX31855 conversion process.
TCM.getTemp(external, internal, scale, error); // Read MAX31855
Serial.print('
What could be the reason?);
Serial.print(external);
Serial.println('#');
}
But if I call it from TimerOne interrupt. It does not work.
§DISCOURSE_HOISTED_CODE_1§
What could be the reason?);
Serial.print(external);
Serial.println('#');
}
What could be the reason?);
Serial.print(external);
Serial.println('#');
}
But if I call it from TimerOne interrupt. It does not work.
§DISCOURSE_HOISTED_CODE_1§
What could be the reason?