summaryrefslogtreecommitdiff
path: root/gpiotest.py
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-04-21 12:58:17 +0200
committerKarel Kočí <karel.koci@nic.cz>2017-04-21 12:58:17 +0200
commit1bf374ab7e2657380b3c23ec4a9d9ba01c627a81 (patch)
treec9956f08d27a2648574488a5944ed6e9830a740d /gpiotest.py
downloadturris-gpio-tests-master.tar.gz
turris-gpio-tests-master.tar.bz2
turris-gpio-tests-master.zip
Just dump all test scripts hereHEADmaster
Diffstat (limited to 'gpiotest.py')
-rwxr-xr-xgpiotest.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/gpiotest.py b/gpiotest.py
new file mode 100755
index 0000000..130c03d
--- /dev/null
+++ b/gpiotest.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+import turris_gpio as gpio
+
+gpio.setmode(gpio.BCM)
+
+gpio.setup(33, gpio.OUT)
+gpio.setup(18, gpio.IN)
+
+gpio.output(33, 0)
+if not gpio.input(18):
+ print("0 fine")
+else:
+ print("0 failed")
+
+
+gpio.output(33, 1)
+if gpio.input(18):
+ print("1 fine")
+else:
+ print("1 failed")
+
+gpio.cleanup()