Initial commit
This commit is contained in:
22
heat/_Heat.py
Normal file
22
heat/_Heat.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import RPi.GPIO as GPIO
|
||||
|
||||
class Heat():
|
||||
def __init__(self, pin):
|
||||
self.__pin = pin
|
||||
self.__state = False
|
||||
GPIO.setwarnings(False)
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(pin, GPIO.OUT)
|
||||
if GPIO.input(pin):
|
||||
self.__state = True
|
||||
|
||||
def on(self):
|
||||
self.__state = True
|
||||
GPIO.output(self.__pin, 1)
|
||||
|
||||
def off(self):
|
||||
self.__state = False
|
||||
GPIO.output(self.__pin, 0)
|
||||
|
||||
def state(self):
|
||||
return self.__state
|
1
heat/__init__.py
Normal file
1
heat/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from ._Heat import Heat
|
Reference in New Issue
Block a user