From 77b788c04889456ec3c9a04a103ae038ed8e0dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Tue, 12 Jul 2022 11:02:21 +0200 Subject: [PATCH] test if moist snesor is fixed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- main.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index e05183d..8c51350 100644 --- a/main.py +++ b/main.py @@ -3,6 +3,8 @@ import os from datetime import datetime import signal import sys +sys.path.append('./SDL_Adafruit_ADS1x15') +import SDL_Adafruit_ADS1x15 try: import paho.mqtt.client as mqtt import gpiozero @@ -15,8 +17,6 @@ except ImportError: print(ImportError) exit() -sys.path.append('./SDL_Adafruit_ADS1x15') -import SDL_Adafruit_ADS1x15 def debug_print(message: str): now = datetime.now() @@ -72,12 +72,11 @@ def signal_handler(signal, frame): signal.signal(signal.SIGINT, signal_handler) def get_moisture(): - ADS1115 = 0x0 - gain = 6144 + gain = 5096 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 + adc = SDL_Adafruit_ADS1x15.ADS1x15(ic=0x01) + print(adc.readADCSingleEnded(0, gain, sps) / 1000) + # 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 #temperature def get_temperature():