Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env python3 | |
2 | ||
3 | import time | |
4 | from enviroplus import gas | |
5 | import logging | |
6 | ||
7 | logging.basicConfig( | |
8 | format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s', | |
9 | level=logging.INFO, | |
10 | datefmt='%Y-%m-%d %H:%M:%S') | |
11 | ||
12 | logging.info("""gas.py - Print readings from the MICS6814 Gas sensor. | |
13 | ||
14 | Press Ctrl+C to exit! | |
15 | ||
16 | """) | |
17 | ||
18 | try: | |
19 | while True: | |
20 | readings = gas.read_all() | |
21 | logging.info(readings) | |
22 | time.sleep(1.0) | |
23 | except KeyboardInterrupt: | |
24 | pass |