Jun-24-2018, 11:01 AM
The code you have posted of function
The read
read_sensor(sensorID)
missing :
SyntaxError.The read
read_sensor(sensorID)
should also return a value as you need that later when comparing.def read_sensor(sensorID): tempfile = open("/sys/bus/w1/devices/"+ sensorID +"/w1_slave") thetext = tempfile.read() tempfile.close() tempdata = thetext.split("\n")[1].split(" ")[9] temperature = float(tempdata[2:]) temp_sensor = temperature / 1000 return temp_sensor # Not print()
Quote:57.0When read_sensor function has no return value only print(),it will return
35.875
Traceback (most recent call last):
File "temp.py", line 10, in <module>
read_sensor(sID1) > read_sensor(sID2)
TypeError: unorderable types: NoneType() > NoneType()
None
.