Archived
1
0
Fork 0

Forget to commit to master the lock >.>

This commit is contained in:
Ethanell 2019-04-20 21:57:08 +02:00
parent 72eecaa20c
commit dea22875e6

27
lock.py Normal file
View file

@ -0,0 +1,27 @@
from gpiozero import LED
import shelve
led = LED(17)
def state(current : bool = None):
if current != None:
with shelve.open("Settings.conf") as settings:
settings["state"] = current
else:
with shelve.open("Settings.conf") as settings:
return settings["state"]
def unlock():
led.on()
state(True)
def lock():
led.off()
state(False)
def switch():
if state():
lock()
else:
unlock()