Sleep before first PMS5003 reading
[EVA-2020-02-2.git] / examples / gas.py
index 6da2a65f9cbf3f1cb66ef5a33377413399871c3f..2f849442b8bf61a253a1083dd2ef561f73ba70c7 100755 (executable)
@@ -1,19 +1,24 @@
 #!/usr/bin/env python
 
 import time
-from envirophatplus import gas
+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!
-        
+
 """)
 
 try:
     while True:
         readings = gas.read_all()
-        print(readings)
+        logging.info(readings)
         time.sleep(1.0)
 except KeyboardInterrupt:
     pass