Commit | Line | Data |
---|---|---|
d8a05f16 PH |
1 | #!/usr/bin/env python |
2 | ||
3 | import time | |
4 | from enviroplus import gas | |
10b73e18 | 5 | import logging |
d8a05f16 | 6 | |
10b73e18 CM |
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("""adc.py - Print readings from the MICS6814 Gas sensor. | |
d8a05f16 PH |
13 | |
14 | Press Ctrl+C to exit! | |
15 | ||
16 | """) | |
17 | ||
18 | gas.enable_adc() | |
19 | gas.set_adc_gain(4.096) | |
20 | ||
21 | try: | |
22 | while True: | |
23 | readings = gas.read_all() | |
10b73e18 | 24 | logging.info(readings) |
d8a05f16 PH |
25 | time.sleep(1.0) |
26 | except KeyboardInterrupt: | |
27 | pass |