From d8a05f16804f6c57f1054d0e3c8962265380fe6b Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Fri, 12 Jul 2019 13:54:25 +0100 Subject: [PATCH] Add example to demo ADC channel usage --- examples/adc.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 examples/adc.py 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 -- 2.30.2