Temperature in celsius

Why I am unable to print the temperature in celsius?
Anyone please check my code once…

As per your code, the temperature will be printed only if it gets out of the range of [minimum threshold, maximum threshold].
The temperature of your room must be within the thresholds, hence print statement is no getting executed.
Bring the print statement out of the if block if you want to see it everytime the loop runs.
Hope you understood the problem.

Hi @khandenathparth I know that when it will go beyond it’s range then only it will get printed.
But my doubt is : I want the temperature to be printed in celsius. for which I have written the conversion formula which is not working in my code.

Before print("Sensor value is: " + str(data[‘value’])) and remove this line

sensor_value = int(data['value'])
temperature = (100*sensor_value)/1024
print("Temperature value is: " + temperature)

@muskanmotwani.1211 You are not printing the temperature, you are only sending the SMS. Kindly add a print statement for printing the temperature, inside the if block.

if sensor_value > maximum_limit or sensor_value < minimum_limit:
    print("Temperature in Celcius : " +str(temperature))

To convert the Temperature value into Celsius …use the formula
temperature = (100*sensor_value)/1024
print("Temperature in Celsius: " +str(temperature))
the data obtained from the LM35 sensor is stored in the sensor_value

this is a python code to convert temprature to celcius

celsius = 37.5

calculate fahrenheit

fahrenheit = (celsius * 1.8) + 32
print(‘%0.1f degree Celsius is equal to %0.1f degree Fahrenheit’ %(celsius,fahrenheit))

@muskanmotwani.1211 @raghav.srivastava