Expand test coverage, bugfix
[EVA-2020-02-2.git] / examples / particulates.py
CommitLineData
0cf10e5b
PH
1#!/usr/bin/env python
2
3import time
85439fb1 4from pms5003 import PMS5003, ReadTimeoutError
0cf10e5b 5
a155e335 6print("""particulates.py - Print readings from the PMS5003 particulate sensor.
0cf10e5b
PH
7
8Press Ctrl+C to exit!
8ab4cd2d 9
0cf10e5b
PH
10""")
11
12pms5003 = PMS5003()
13time.sleep(1.0)
14
0cf10e5b
PH
15try:
16 while True:
85439fb1
SM
17 try:
18 readings = pms5003.read()
19 print(readings)
20 time.sleep(1.0)
21 except ReadTimeoutError:
22 pms5003 = PMS5003()
0cf10e5b
PH
23except KeyboardInterrupt:
24 pass