#!/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"