From 45ff4cbc22f542d424aa826a93e18d6b6d0e71ba Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Sun, 20 Mar 2016 16:56:24 +0000 Subject: [PATCH] collect stuff --- engine.py | 27 +++++++++++++++++++++++++++ gpio_test.py | 7 +++++++ 2 files changed, 34 insertions(+) create mode 100644 engine.py create mode 100755 gpio_test.py diff --git a/engine.py b/engine.py new file mode 100644 index 0000000..f9aa2a7 --- /dev/null +++ b/engine.py @@ -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): + diff --git a/gpio_test.py b/gpio_test.py new file mode 100755 index 0000000..55bd2cf --- /dev/null +++ b/gpio_test.py @@ -0,0 +1,7 @@ +#!/usr/bin/python2 +from gpio import gpio + +g13 = gpio(13) +g13.export() +g13.direction("out") +