20 lines
363 B
Python
20 lines
363 B
Python
|
try:
|
||
|
import gpio
|
||
|
except ImportError:
|
||
|
raise ImportError("gpio not found.")
|
||
|
|
||
|
class Heat(object):
|
||
|
def __init__(self, pin):
|
||
|
self.pin = gpio.Gpio(pin)
|
||
|
|
||
|
self.pin.export()
|
||
|
self.pin.direction(gpio.Gpio.DIRECTION_OUT)
|
||
|
|
||
|
self.pin.write(0)
|
||
|
|
||
|
def on(self):
|
||
|
self.pin.write(1)
|
||
|
|
||
|
def off(self):
|
||
|
self.pin.write(0)
|