It is my interest to explore your problem a little bit more for which I would like to request you to give answer to the following questions:
-
All codes of your original program (without float) with code tags. This is to see that you have or have not really declared data type for your variable temperature.
-
Which Arduino (UNO, NANO, DUE, MEGA) have you used with LM35 sensor?
-
Which analog channel have you used to acquire analog signal from LM35?
-
What is the reference voltage (DEFAULT = 5V; INTERNAL = 1.1V, EXTERNAL = AREF) that you have used for the ADC?
Thanks.