From: Phil Howard Date: Fri, 12 Jul 2019 12:54:25 +0000 (+0100) Subject: Add example to demo ADC channel usage X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02-2.git/commitdiff_plain/d8a05f16804f6c57f1054d0e3c8962265380fe6b?ds=sidebyside;hp=4b18dd3abf2709cb4b5bdbbb7cdd9a85b04aaac0 Add example to demo ADC channel usage --- diff --git a/examples/adc.py b/examples/adc.py new file mode 100755 index 0000000..c4cf45c --- /dev/null +++ b/examples/adc.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import time +from enviroplus import gas + +print("""adc.py - Print readings from the MICS6814 Gas sensor. + +Press Ctrl+C to exit! + +""") + +gas.enable_adc() +gas.set_adc_gain(4.096) + +try: + while True: + readings = gas.read_all() + print(readings) + time.sleep(1.0) +except KeyboardInterrupt: + pass