From 85351558db0ebec455f24638ee93c47f05833afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sun, 10 Jul 2022 18:58:12 +0200 Subject: [PATCH] next test with cooldown (1 sec) --- main.py | 4 +--- test.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 464d983..c15978f 100644 --- a/main.py +++ b/main.py @@ -75,6 +75,4 @@ def get_moisture(): sps = 250 adc = SDL_Adafruit_ADS1x15.ADS1x15(ic=ADS1115) - voltsChArray = [adc.readADCSingleEnded(0, gain, sps) / 1000, adc.readADCSingleEnded(1, gain, sps) / 1000, adc.readADCSingleEnded(2, gain, sps) / 1000, adc.readADCSingleEnded(3, gain, sps) / 1000] - - return sum(voltsChArray) / float(len(voltsChArray)) \ No newline at end of file + 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/test.py b/test.py index e335201..f749b1b 100644 --- a/test.py +++ b/test.py @@ -17,7 +17,7 @@ def get_moisture(): 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 + 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 while True: print(get_moisture())