collect stuff

This commit is contained in:
Thomas Klaehn 2016-03-20 16:56:24 +00:00 committed by Thomas Klaehn
parent 4998d3a2e5
commit 45ff4cbc22
2 changed files with 34 additions and 0 deletions

27
engine.py Normal file
View File

@ -0,0 +1,27 @@
class engine:
def __init__(self, gpio_1 = 13, gpio_2 = 19):
self.gpio_1 = gpio_1
self.gpio_2 = gpio_2
# export gpio's
n = "/sys/class/gpio/gpio" + str(self.gpio_1)
if not islink(n):
f = open("sys/class/gpio/export", "w")
f.write(str(self.gpio_1)
f = open("sys/class/gpio/gpio" + str(self.gpio_1) +\
"/value", "w")
f.write("out")
n = "/sys/class/gpio/gpio" + str(self.gpio_2)
if not islink(n):
f = open("sys/class/gpio/export", "w")
f.write(str(self.gpio_2)
f = open("sys/class/gpio/gpio" + str(self.gpio_2) +\
"/value", "w")
f.write("out")
def stop(self):

7
gpio_test.py Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/python2
from gpio import gpio
g13 = gpio(13)
g13.export()
g13.direction("out")