From 624274051e2faa7febc0a4ef87cce1ee5ea1ac20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sun, 10 Jul 2022 19:44:39 +0200 Subject: [PATCH] added adafruit temp module into req list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- main.py | 1 + requirements.txt | 1 + test.py | 25 ++++++------------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/main.py b/main.py index c15978f..12e6d9d 100644 --- a/main.py +++ b/main.py @@ -76,3 +76,4 @@ def get_moisture(): adc = SDL_Adafruit_ADS1x15.ADS1x15(ic=ADS1115) return adc.readADCSingleEnded(0, gain, sps) / 1000 + adc.readADCSingleEnded(1, gain, sps) / 1000 + adc.readADCSingleEnded(2, gain, sps) / 1000 + adc.readADCSingleEnded(3, gain, sps) / 1000 + diff --git a/requirements.txt b/requirements.txt index 65f7416..fa3fb09 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ gpiozero==1.6.2 +adafruit-circuitpython-bmp280==3.2.15 \ No newline at end of file diff --git a/test.py b/test.py index f749b1b..2f07999 100644 --- a/test.py +++ b/test.py @@ -1,24 +1,11 @@ +import board +import busio +import adafruit_bmp280 import time -import signal -import sys -sys.path.append('./SDL_Adafruit_ADS1x15') - -import SDL_Adafruit_ADS1x15 - -def signal_handler(signal, frame): - sys.exit(0) - -signal.signal(signal.SIGINT, signal_handler) - -def get_moisture(): - ADS1115 = 0x01 - gain = 6144 - sps = 250 - adc = SDL_Adafruit_ADS1x15.ADS1x15(ic=ADS1115) - - return adc.readADCSingleEnded(0, gain, sps) / 1000 + adc.readADCSingleEnded(1, gain, sps) / 1000 + adc.readADCSingleEnded(2, gain, sps) / 1000 + adc.readADCSingleEnded(3, gain, sps) / 1000 +def get_temperature(): + while True: - print(get_moisture()) + print(get_temperature()) time.sleep(1) \ No newline at end of file