diff options
author | Karel Kočí <karel.koci@nic.cz> | 2017-04-21 12:58:17 +0200 |
---|---|---|
committer | Karel Kočí <karel.koci@nic.cz> | 2017-04-21 12:58:17 +0200 |
commit | 1bf374ab7e2657380b3c23ec4a9d9ba01c627a81 (patch) | |
tree | c9956f08d27a2648574488a5944ed6e9830a740d /gpiotest.sh | |
download | turris-gpio-tests-master.tar.gz turris-gpio-tests-master.tar.bz2 turris-gpio-tests-master.zip |
Diffstat (limited to 'gpiotest.sh')
-rwxr-xr-x | gpiotest.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gpiotest.sh b/gpiotest.sh new file mode 100755 index 0000000..00e7eb2 --- /dev/null +++ b/gpiotest.sh @@ -0,0 +1,20 @@ +#!/bin/sh +G1=18 +G2=33 + +SYS=/sys/class/gpio + +[ -d $SYS/gpio$G1 ] || echo $G1 > $SYS/export +[ -d $SYS/gpio$G2 ] || echo $G2 > $SYS/export + +echo in > $SYS/gpio$G1/direction +echo out > $SYS/gpio$G2/direction + +echo 1 > $SYS/gpio$G2/value +[ "$(cat $SYS/gpio$G1/value)" = "1" ] || echo "1 failed" + +echo 0 > $SYS/gpio$G2/value +[ "$(cat $SYS/gpio$G1/value)" = "0" ] || echo "0 failed" + +echo $G1 > $SYS/unexport +echo $G2 > $SYS/unexport |