stm32-fmt-code/access_control_python/mcu_test.py

31 lines
864 B
Python
Raw Normal View History

2023-09-24 18:30:29 +00:00
from access_control import access_control
from line_notify import LineNotify
import time
stm32 = access_control("COM12")
time.sleep(1)
while True:
cmd = input("Enter Command : ")
if(cmd == 'lock'):
stm32.lock_door()
if(cmd == 'unlock'):
stm32.unlock_door()
2023-09-30 08:23:10 +00:00
if(cmd == 'scan_state'):
print(stm32.get_scan_state())
if(cmd == 'door_state'):
print(stm32.get_door_state())
2023-09-24 18:30:29 +00:00
#stm32.unlock_door()
time.sleep(1)
#door_state = False
#while True:
#print(stm32._in_payloads)
#if(door_state != stm32.get_door_state()):
# door_state = stm32.get_door_state()
# notify = LineNotify("olK1QXriiuKgfxB6xkj7SIFfj9jsXfpl2PqmjCDuBRw")
# notify.send(f'door is {door_state}')
#if(stm32.get_door_state() == True):
# stm32.lock_door()
#else:
# stm32.unlock_door()
#time.sleep(0.01)