MAX6675 using nan as feedback

Hi All,

I have an application where I am using multiple MAX6675 sensors which work great but I'm trying to write in some troubleshooting code...

The sensors are in a temperature controlled environment that will never go below zero and from my experience with the sensors they respond with a '0.00' if the thermocouple is disconnected so I have a 'multiple zero check' in code which works great.

The issue that I have is when the sensor/board has a fault it typically responds 'nan'... how do I run a check against nan?

Zero is easy enough to check

float tempRead = tempSensor.readCelsius();

if (tempRead == 0.00){
    //Loop read to ensure not 'one off'
    //Thermocouple Error Code
  }

but obviously

if (tempRead == nan){
    //Sensor error code
  }

would not compile as it won't know what 'nan' is... (I tried anyway and got the result I expected).

How can I read/store/use 'nan' to my advantage or is what I'm asking simply not possible?

try uppercase NAN
or better:
if (isnan(tempread)) ...

knut_ny:
try uppercase NAN
or
isnan(tempread)

wow...

the uppercase compiles with no issues and seems to work! Thanks!! Didn't think it would be that simple and I feel so stupid for not trying it!

as NAN is a function, i believe the 'isnan' is the preferred variant