chickenhouse/gate_guard/engine.py

30 lines
636 B
Python
Raw Normal View History

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