In that case, the read function will read invalid data, obviously with a wrong CRC, and raises a CRC error. That is the expected behavior.
In your script you can catch the CRC error with try/except clause around read.temp(), e.g. as:
In that case, the script will continue and print error message until you reconnect the sensor.
Code: Select all
for rom in roms: try: print (ds.read_temp (rom), end = '|') except CRCError: print("CRC error reading the termperature, unit", rom)
Obviously, you may implement any reasonable error handling instead.