コード例 #1
0
class DoorController:
    def __init__(self):
        self.lock = Lock(5)

    def send_open_pulse(self):
        self.lock.unlock()
コード例 #2
0
ファイル: main_pi.py プロジェクト: philippeVoNam/Lock
from firebase_com import FirebaseCom
from lock import Lock
import time

com = FirebaseCom()
lock = Lock()
currentState = "locked"

while True:
    time.sleep(1)
    status = com.read()

    if status == "open" and currentState == "locked":
        print(status)
        lock.unlock()
        currentState = "unlocked"

    elif status == "lock" and currentState == "unlocked":
        print(status)
        lock.lock()
        currentState = "locked"

    else:
        print("should not come here")