Hi,
I'm sorry for my bad English.
I'm currently try to make a prototype that use 4x max31855 SPI chips to grab TK temperature and send them over CAN bus. I have it working but my initial code was "heavy". Today I try to simplify it and I face a problem. I use a teensy andAdafruit MAX31855 library.
Here the MAX and TK information declaration code :
In the main loop I try to do :
But TK.readCelsius() (and other calls) didn't work because of TK. Is there a way to call MAX31855 library function without using TK1, TK2, TK3 or TK4 but something that will reflect i ?
Thank,
Manu
I'm sorry for my bad English.
I'm currently try to make a prototype that use 4x max31855 SPI chips to grab TK temperature and send them over CAN bus. I have it working but my initial code was "heavy". Today I try to simplify it and I face a problem. I use a teensy andAdafruit MAX31855 library.
Here the MAX and TK information declaration code :
Code:
#define nbTK 4
MAX31855 TK1 = MAX31855(MAX31855_1_CS);
MAX31855 TK2 = MAX31855(MAX31855_2_CS);
MAX31855 TK3 = MAX31855(MAX31855_3_CS);
MAX31855 TK4 = MAX31855(MAX31855_4_CS);
struct infoTK {
double rawTemp;
double internalTemp;
double linTemp;
uint8_t error;
};
struct infoTK infoTK[nbTK];
In the main loop I try to do :
Code:
void loop() {
if (Serial.available()) // Mode configuration.
{
ModeConfiguration();
}
else { // Mode fonctionnement
for (int i = 1; i <= nbTK; i++) {
infoTK[i].rawTemp = TK[i].readCelsius();
if (isnan(infoTK[i].rawTemp)) {
infoTK[i].error = TK[i].readError();
}
else {
infoTK[i].error = 0;
infoTK[i].internalTemp = TK[i].readInternal();
infoTK[i].linTemp = linearisationTemperature(infoTK[i].rawTemp, infoTK[i].internalTemp);
}
delay(5);
}
Watchdog.reset();
}
}
But TK.readCelsius() (and other calls) didn't work because of TK. Is there a way to call MAX31855 library function without using TK1, TK2, TK3 or TK4 but something that will reflect i ?
Thank,
Manu