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
Catch #61 with tests and fix
[EVA-2020-02-2.git]
/
examples
/
adc.py
diff --git
a/examples/adc.py
b/examples/adc.py
index c4cf45cf8f0d598e2fd88ea93f10812b874de737..a345d232948d512333c81cd6d9a958ac535a32ae 100755
(executable)
--- a/
examples/adc.py
+++ b/
examples/adc.py
@@
-1,9
+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
-print("""adc.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("""adc.py - Print readings from the MICS6814 Gas sensor.
Press Ctrl+C to exit!
Press Ctrl+C to exit!
@@
-15,7
+21,7
@@
gas.set_adc_gain(4.096)
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