parent
f45ad8f79c
commit
9cc7a6b366
6
main.py
6
main.py
|
@ -19,7 +19,8 @@ except ImportError:
|
||||||
sys.path.append('./SDL_Adafruit_ADS1x15')
|
sys.path.append('./SDL_Adafruit_ADS1x15')
|
||||||
import SDL_Adafruit_ADS1x15
|
import SDL_Adafruit_ADS1x15
|
||||||
|
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setwarnings(False)
|
||||||
|
GPIO.setmode(GPIO.BOARD)
|
||||||
|
|
||||||
def debug_print(message: str):
|
def debug_print(message: str):
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
|
@ -64,7 +65,7 @@ def get_water_level():
|
||||||
TimeElapsed = StopTime - startTime
|
TimeElapsed = StopTime - startTime
|
||||||
distance = (TimeElapsed * 34300) / 2
|
distance = (TimeElapsed * 34300) / 2
|
||||||
|
|
||||||
return distance
|
return int(distance)
|
||||||
|
|
||||||
#moisture
|
#moisture
|
||||||
def signal_handler(signal, frame):
|
def signal_handler(signal, frame):
|
||||||
|
@ -88,3 +89,4 @@ def get_temperature():
|
||||||
|
|
||||||
print(get_moisture())
|
print(get_moisture())
|
||||||
print(get_water_level())
|
print(get_water_level())
|
||||||
|
print(get_moisture())
|
Loading…
Reference in New Issue