diff --git a/main.py b/main.py index 399cde6..195f65d 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,16 @@ +def debug_print(message: str): + now = datetime.now() + current_time = now.strftime("%H:%M:%S") + print('[DEBUG]['+current_time+'] '+message) + +def error_print(message: str): + now = datetime.now() + current_time = now.strftime("%H:%M:%S") + print('[ERROR]['+current_time+'] '+message) + +debug_print("Importing modules") + + from string import whitespace import time from datetime import datetime @@ -14,15 +27,7 @@ except ImportError: print(ImportError) exit() -def debug_print(message: str): - now = datetime.now() - current_time = now.strftime("%H:%M:%S") - print('[DEBUG]['+current_time+'] '+message) - -def error_print(message: str): - now = datetime.now() - current_time = now.strftime("%H:%M:%S") - print('[ERROR]['+current_time+'] '+message) +debug_print("Imported modules") #relay def relay_controller(pin: int, state: str): @@ -60,6 +65,8 @@ def get_water_level(): rounded_distance = int(distance) return str(rounded_distance) +debug_print("Added water level detector") + #temperature def get_temperature(): i2c = busio.I2C(board.SCL, board.SDA) @@ -67,6 +74,8 @@ def get_temperature(): rounded_temp = int(bmp280.temperature) return str(rounded_temp) +debug_print("Added temperature sensor") + print(get_water_level()) print(get_temperature())