projects
/
EVA-2020-02-2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat(examples):Add baltakatei's all-in-one-enviro-mini py script
[EVA-2020-02-2.git]
/
examples
/
particulates.py
diff --git
a/examples/particulates.py
b/examples/particulates.py
index e71ca5d96f78782f5237134e1dffd3df51dfcf7e..04a49500b0adfaa388ebd89c42be8a9578d7634f 100755
(executable)
--- a/
examples/particulates.py
+++ b/
examples/particulates.py
@@
-1,9
+1,15
@@
-#!/usr/bin/env python
+#!/usr/bin/env python
3
import time
from pms5003 import PMS5003, ReadTimeoutError
import time
from pms5003 import PMS5003, ReadTimeoutError
+import logging
-print("""particulates.py - Print readings from the PMS5003 particulate sensor.
+logging.basicConfig(
+ format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
+ level=logging.INFO,
+ datefmt='%Y-%m-%d %H:%M:%S')
+
+logging.info("""particulates.py - Print readings from the PMS5003 particulate sensor.
Press Ctrl+C to exit!
Press Ctrl+C to exit!
@@
-16,8
+22,7
@@
try:
while True:
try:
readings = pms5003.read()
while True:
try:
readings = pms5003.read()
- print(readings)
- time.sleep(1.0)
+ logging.info(readings)
except ReadTimeoutError:
pms5003 = PMS5003()
except KeyboardInterrupt:
except ReadTimeoutError:
pms5003 = PMS5003()
except KeyboardInterrupt: