#!/usr/bin/env python
import time
-from pms5003 import PMS5003
+from pms5003 import PMS5003, ReadTimeoutError
print("""particulates.py - Print readings from the PMS5003 particulate sensor.
try:
while True:
- readings = pms5003.read()
- print(readings)
- time.sleep(1.0)
+ try:
+ readings = pms5003.read()
+ print(readings)
+ time.sleep(1.0)
+ except ReadTimeoutError:
+ pms5003 = PMS5003()
except KeyboardInterrupt:
pass