Hello, I am getting the Error : name ‘temperature’ is not defined when I am running my code. Below is the screenshot of my code. Please correct me.
‘sensor_value’ variable is also assigned in the ‘try’ block but it does not generate name error. Then why does ‘temperature’ variable generate the name error?
you have done spelling mistake write same variable in print statement and to calculate temperature value.
e.g
temperature = (100 * sensor_value)/1024
print(temperature)
2 Likes
Thanks bro, I also noticed that afterwards.