2017-03-30 13:15:00 +00:00
|
|
|
'''
|
|
|
|
Created on Mar 30, 2017
|
|
|
|
|
|
|
|
@author: tkla
|
|
|
|
'''
|
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):
|
2017-04-11 07:13:33 +00:00
|
|
|
self.gpio_1.write(0)
|
|
|
|
self.gpio_2.write(0)
|
2016-12-20 21:09:01 +00:00
|
|
|
|
|
|
|
def up(self):
|
2017-04-11 07:13:33 +00:00
|
|
|
self.gpio_1.write(1)
|
|
|
|
self.gpio_2.write(0)
|
2016-12-20 21:09:01 +00:00
|
|
|
|
|
|
|
def down(self):
|
2017-04-11 07:13:33 +00:00
|
|
|
self.gpio_1.write(0)
|
|
|
|
self.gpio_2.write(1)
|