Adafruit Max31856 thermocouple amp and Max31865 RTD amp codes will not compile

Greetings. I made a jet engine exhaust gas temperature (EGT) Temperature Controller using an Adafruit Max31856 thermocouple amplifier (to measure EGT) and a Max31865 RTD amplifier to measure compressor inlet temperature (CIT). The project is still in development. The immediate problem is the Adafruit Max31856 thermocouple amp and Max31865 RTD amp code will not compile together in the same sketch. Each compiles perfectly independent of the other when I /* */ comment one or the other out.

I don't know, but my problem may be in LadyAda's use of "max" (the IDE see it as "max/min" rather than a variable name for either the Max31856 or Max31865). I don't understand the code or know how to declare it.

Example:

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX3156 max = Adafruit_MAX3156 (53, 51,50, 52);
// Use hardware SPI, just pass in the CS pin
// Adafruit_MAX31656 max = Adafruit_MAX31856 (53);

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 max = Adafruit_MAX31865 (49, 51, 50, 52);
// Use hardware SPI, just pass in the CS pin
// Adafruit_MAX31865 max = Adafruit_MAX31865 (49);

Error messages:

Exit status 1

Conflicting declaration 'Adafruit_MAX31865 max'

Thank you. I really appreciate your help.

MJRusaw1

Have you tried to use the commented out version of the constructor calls? As you're using the hardware SPI interface you should use the correct constructor. You cannot use the same pins for the bitbang interface.

And you shouldn't call both variables "max".

And you shouldn't call both variables "max".

You shouldn't call either variable max.

Thank you for quick reply. I appreciate it. I have everything to learn. After I posted, I named one "max0" and the other "max1" and reflected it in the rest of the sketch. It compiled past the original error with a new concerning a conflict between "uint8_Fault = max0.readFault ();" and "uint8_Fault = max1.readFault ();", so I commented out the latter (max1) and it compiled.

I don't know what "uint8" (or "uint16") mean yet, so I'll have to find out. From your observation it seems that uint8 for max0 and max1 can't have the name.

Once I discover what uint8 means, may be I can resolve the conflict with another name. At any rate, being able to read the faults is a bonus, which is nice but not entirely necessary.

May I ask, do you know what "uint8" refers to and means?

Again, thank you so much. You are right, I renamed "max" and fixed 90% of the problem.

I am learning.

MJRusaw1

uint8_t is a type (unsigned int, 8 bits).

Unsigned integer, 8 bits. Thank you. I appreciate your help. I will research it.

It seems obvious that uint16_t is 16 bits.

May I ask why you think I have the conflict between the max0 and max1, 8 bit unsigned integers?

Thanks, again.

MJRusaw1

I researched "uint8_Fault" on lunch break at work and discovered that "uint8_Fault" does not exist. It should be "uint8_t fault."

Can't wait to try it when I get home.

Thank you for the insight and inspiration.

MJRusaw1

I changed the code to "uint8_t fault0 =" and uint8_t fault1 =" then made the rest of the code reflect the change and both the Max31856 and the Max31865 compiled together without errors.

Thanks so much to all.

Now, I have to finish the project code and see if it will run on my Mega 2560.

MJRusaw1