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) voltsCh = 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 voltsCh while True: print(get_moisture())