parent
ce012d179e
commit
77b788c048
13
main.py
13
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():
|
||||
|
|
Loading…
Reference in New Issue