diff --git a/EXAMPLES/Shell/GPIOTEST/README b/EXAMPLES/Shell/GPIOTEST/README new file mode 100644 index 0000000..981e62e --- /dev/null +++ b/EXAMPLES/Shell/GPIOTEST/README @@ -0,0 +1,7 @@ +This bash script tests the user gpios. + +Everything should be disconnected from the gpios. + +The pigpio daemon must be running (sudo pigpiod). + +Video at http://youtu.be/sCJFLKWaxHo diff --git a/EXAMPLES/Shell/GPIOTEST/gpiotest b/EXAMPLES/Shell/GPIOTEST/gpiotest new file mode 100755 index 0000000..b04b622 --- /dev/null +++ b/EXAMPLES/Shell/GPIOTEST/gpiotest @@ -0,0 +1,126 @@ +#!/bin/bash + +skipped="" +tested="" +failed="" + +usage() +{ + cat </dev/null + +usage + +v=$(pigs hwver) + +if [[ $v < 0 ]] +then + echo "The pigpio daemon wasn't found. Did you sudo pigpiod?" + exit +fi + +echo "Testing..." + +for ((i=0; i<4; i++)) do check_gpio $i 1; done +for ((i=4; i<16; i++)) do check_gpio $i 0; done + +if [[ $v -ge 16 ]]; +then + check_gpio 16 0 +else + skipped+="16 " +fi + +for ((i=17; i<28; i++)) do check_gpio $i 0; done +for ((i=28; i<30; i++)) do check_gpio $i 1; done +for ((i=30; i<32; i++)) do check_gpio $i 0; done + +if [[ $failed = "" ]]; then failed="None"; fi + +echo "Skipped non-user gpios: $skipped" +echo "Tested user gpios: $tested" +echo "Failed user gpios: $failed" +