This repository has been archived on 2019-10-02. You can view files and clone it, but cannot push or open issues or pull requests.
Files
DoorUnlocker/chip_unlocker.py
2019-10-02 15:26:09 +08:00

20 lines
469 B
Python

import time
import CHIP_IO.GPIO as GPIO
class ChipUnlocker:
def __init__(self, unlock_pin: str):
self.unlock_pin = unlock_pin
def unlock(self):
# 設定接腳
GPIO.setup(self.unlock_pin, GPIO.OUT)
# 送出低電位 0.4 秒後回復到高電位
GPIO.output(self.unlock_pin, GPIO.LOW)
time.sleep(0.4)
GPIO.output(self.unlock_pin, GPIO.HIGH)
# 復歸接腳
GPIO.cleanup(self.unlock_pin)