2017-03-30 09:58:55 +00:00
|
|
|
import gpio
|
2016-12-20 21:09:01 +00:00
|
|
|
|
2017-03-30 09:58:55 +00:00
|
|
|
class Engine(object):
|
2016-12-20 21:09:01 +00:00
|
|
|
def __init__(self, gpio_1 = 13, gpio_2 = 19):
|
2017-03-30 09:58:55 +00:00
|
|
|
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()
|
2017-03-30 09:58:55 +00:00
|
|
|
self.gpio_1.direction(gpio.Gpio.DIRECTION_OUT)
|
2016-12-20 21:09:01 +00:00
|
|
|
self.gpio_2.export()
|
2017-03-30 09:58:55 +00:00
|
|
|
self.gpio_2.direction(gpio.Gpio.DIRECTION_OUT)
|
2016-12-20 21:09:01 +00:00
|
|
|
self.stop()
|
|
|
|
|
|
|
|
def stop(self):
|
|
|
|
self.gpio_1.set(0)
|
|
|
|
self.gpio_2.set(0)
|
|
|
|
|
|
|
|
def up(self):
|
|
|
|
self.gpio_1.set(1)
|
|
|
|
self.gpio_2.set(0)
|
|
|
|
|
|
|
|
def down(self):
|
|
|
|
self.gpio_1.set(0)
|
|
|
|
self.gpio_2.set(1)
|