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
Python 3-related fixes, moving to pip fonts, fixing Astral errors.
[EVA-2020-02-2.git]
/
examples
/
gas.py
diff --git
a/examples/gas.py
b/examples/gas.py
index 8717922cdfc9d4122d2e501f64c6e67f35dbb89c..5d72cb937f682fb11e8c23e43184d0c1d581dffb 100755
(executable)
--- a/
examples/gas.py
+++ b/
examples/gas.py
@@
-1,10
+1,15
@@
-#!/usr/bin/env python
+#!/usr/bin/env python
3
import time
from enviroplus import gas
import time
from enviroplus import gas
+import logging
+logging.basicConfig(
+ format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
+ level=logging.INFO,
+ datefmt='%Y-%m-%d %H:%M:%S')
-
print("""gas.py - Print readings from the MICS6812
Gas sensor.
+
logging.info("""gas.py - Print readings from the MICS6814
Gas sensor.
Press Ctrl+C to exit!
Press Ctrl+C to exit!
@@
-13,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