2020-07-31 09:46:07 +02:00

23 lines
352 B
Bash
Executable File

#!/bin/sh
if [ $# -ne 2 ]; then
echo "ERROR GPIO ARGS"
exit 1
fi
pin=$(gpiofind "${1}")
if [ $? -ne 0 ]; then
echo "ERROR GPIO PIN"
exit 1
fi
case ${2} in
0) value=${2};;
1) value=${2};;
*) echo "ERROR GPIO VALUE"; exit 1;;
esac
gpioset ${pin}=${value}
if [ $? -ne 0 ]; then
echo "ERROR GPIO I2C"
else
echo "OK"
fi