Hi my friends I am having a trouble with my sensor ds18b20 and my code, after a few measures, suddenly the program stops and shows:
File ds18x20.py, Line 40 in read_temp
File ds18x20.py, line 30 in read_scratch
Excetpion:crc error
Problems with ds18b20
Re: Problems with ds18b20
This suggests that there is possibly a wiring issue and messages from the sensor are being corrupted (or possibly there's a timing issue decoding it).
If it only happens occasionally, then maybe just catch the exception and retry:
Code: Select all
try:
sensor.read_temp()
except:
...handle error? Maybe retry?