moved some stuff into get_water_level
Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>master
parent
f354c7a54c
commit
2ebbfb9dc4
13
main.py
13
main.py
|
@ -18,9 +18,6 @@ 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.BOARD)
|
|
||||||
GPIO.setwarnings(False)
|
|
||||||
|
|
||||||
def debug_print(message: str):
|
def debug_print(message: str):
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
current_time = now.strftime("%H:%M:%S")
|
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+")")
|
error_print("Unknown status for relay ("+status+")")
|
||||||
|
|
||||||
#ultrasonic
|
#ultrasonic
|
||||||
GPIO_TRIGGER = 18
|
|
||||||
GPIO_ECHO = 24
|
|
||||||
GPIO.setup(GPIO_TRIGGER, GPIO.OUT)
|
|
||||||
GPIO.setup(GPIO_ECHO, GPIO.IN)
|
|
||||||
|
|
||||||
def get_water_level():
|
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)
|
GPIO.output(GPIO_TRIGGER, True)
|
||||||
time.sleep(0.00001)
|
time.sleep(0.00001)
|
||||||
GPIO.output(GPIO_TRIGGER, False)
|
GPIO.output(GPIO_TRIGGER, False)
|
||||||
|
|
Loading…
Reference in New Issue