NMEA 2000 Shield

timolappalainen:
That is simple linear conversion:

TempC = -20 + (x-0)*(150- -20)/(3.3-0); // , where x is your voltage.

For library function you have to provide values in Kelvin, so you use
...CToKelvin(TempC)...

Or better would be use SI in code inside and use conversion only for view values. Then your function would be:

TempK = 253.15 + (x-0)*(423.15-253.15)/(3.3-0);

Then you can just pass TempK to library function.

That looks good so far, just one thing:
It results in a negative value. I get shown -21.7 C and just multiplying it by -1 doesn't work for any reason.

Can this be used for any kind of temp value like oiltemp ?