moved some stuff into get_water_level

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-07-12 10:00:37 +02:00
parent f354c7a54c
commit 2ebbfb9dc4
1 changed files with 6 additions and 7 deletions

13
main.py
View File

@ -18,9 +18,6 @@ except ImportError:
sys.path.append('./SDL_Adafruit_ADS1x15')
import SDL_Adafruit_ADS1x15
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
def debug_print(message: str):
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
@ -43,12 +40,14 @@ def relay_controller(pin: int, status: str):
error_print("Unknown status for relay ("+status+")")
#ultrasonic
GPIO_TRIGGER = 18
GPIO_ECHO = 24
GPIO.setup(GPIO_TRIGGER, GPIO.OUT)
GPIO.setup(GPIO_ECHO, GPIO.IN)
def get_water_level():
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO_TRIGGER = 18
GPIO_ECHO = 24
GPIO.setup(GPIO_TRIGGER, GPIO.OUT)
GPIO.setup(GPIO_ECHO, GPIO.IN)
GPIO.output(GPIO_TRIGGER, True)
time.sleep(0.00001)
GPIO.output(GPIO_TRIGGER, False)