Hello everybody!
Im trying to get my head around a part of my project, the temperature sensors to be precise..
I will be using LM75A temperature sensors over i2c bus when they eventually arrive from china, but im trying to get some code ready to test until then.
Now, i found this neat looking library, on github (LINK), but im not sure how to use it properly..
it boils down to this; i want to read a sensor, compare the result with a pre-set max-value and if its over the value, execute a command (in my case; turn off the voltage regulator thats too hot with a FET).
from what i gather from the .cpp file, the returned value is a float, when asked with a "lm75a.getTemperature()", and the value is already in °Celcius too.
The reference page on arduino.cc isnt too clear, but it suggests some very strange behaviors when doing math with floats and they should be avoided since they're slower as well..
But does that also include a comparator?
The returned value (from what i understand and guesstimate) would be something like 19.120°C in a room-temperature environment, and i would like to compare that float with a byte since i wont be needing hundreds of °C, say 80(°C) tops..
So could i do this straight up with a
"
byte byteTempLIMIT = 65; // temperature in °C for thermal cutoff
float floatTemp = lm75a.getTemperature();
if (floatTemp > byteTempLIMIT){ chillRoutine(); }
"
or would it demand more programmer wodoo?
If i cant compare bytes and floats, i will convert the float to a byte and then compare the two, but i would like to keep it simple, therefore avoid this step if possible..