chickenhouse/gate_guard/engine.py
Thomas Klaehn 16931c50ba gate: post open/close msg via telegram
Signed-off-by: Thomas Klaehn <thomas.klaehn@u-blox.com>
2018-08-27 11:27:50 +02:00

30 lines
636 B
Python

'''
Created on Mar 30, 2017
@author: tkla
'''
import gpio
class Engine(object):
def __init__(self, gpio_1 = 13, gpio_2 = 19):
self.gpio_1 = gpio.Gpio(gpio_1)
self.gpio_2 = gpio.Gpio(gpio_2)
self.gpio_1.export()
self.gpio_1.direction(gpio.Gpio.DIRECTION_OUT)
self.gpio_2.export()
self.gpio_2.direction(gpio.Gpio.DIRECTION_OUT)
self.stop()
def stop(self):
self.gpio_1.write(0)
self.gpio_2.write(0)
def up(self):
self.gpio_1.write(1)
self.gpio_2.write(0)
def down(self):
self.gpio_1.write(0)
self.gpio_2.write(1)