summaryrefslogtreecommitdiff
path: root/gpioedge.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 /gpioedge.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 'gpioedge.py')
-rwxr-xr-xgpioedge.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/gpioedge.py b/gpioedge.py
new file mode 100755
index 0000000..097b690
--- /dev/null
+++ b/gpioedge.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python2
+import turris_gpio as gpio
+
+gpio.setmode(gpio.BCM)
+
+gpio.setup(18, gpio.IN)
+
+channel = gpio.wait_for_edge(18, gpio.BOTH, timeout=5000)
+print("both " + str(channel))
+channel = gpio.wait_for_edge(18, gpio.RISING)
+print("rising " + str(channel))
+channel = gpio.wait_for_edge(18, gpio.FALLING)
+print("falling " + str(channel))
+channel = gpio.wait_for_edge(18, gpio.BOTH)
+print("both " + str(channel))
+channel = gpio.wait_for_edge(18, gpio.BOTH)
+print("both " + str(channel))
+
+gpio.cleanup()