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
Merge pull request #39 from Kostadin/combined_mode_example
[EVA-2020-02-2.git]
/
examples
/
gas.py
diff --git
a/examples/gas.py
b/examples/gas.py
index faf6eac84611944ec9b908cefeb7b47e1e31518d..2f849442b8bf61a253a1083dd2ef561f73ba70c7 100755
(executable)
--- a/
examples/gas.py
+++ b/
examples/gas.py
@@
-2,8
+2,14
@@
import time
from enviroplus import gas
import time
from enviroplus import gas
+import logging
-print("""gas.py - Print readings from the MICS6814 Gas sensor.
+logging.basicConfig(
+ format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
+ level=logging.INFO,
+ datefmt='%Y-%m-%d %H:%M:%S')
+
+logging.info("""gas.py - Print readings from the MICS6814 Gas sensor.
Press Ctrl+C to exit!
Press Ctrl+C to exit!
@@
-12,7
+18,7
@@
Press Ctrl+C to exit!
try:
while True:
readings = gas.read_all()
try:
while True:
readings = gas.read_all()
-
print
(readings)
+
logging.info
(readings)
time.sleep(1.0)
except KeyboardInterrupt:
pass
time.sleep(1.0)
except KeyboardInterrupt:
pass