24 lines
463 B
Bash
Executable File
24 lines
463 B
Bash
Executable File
#!/bin/sh
|
|
|
|
GPIO_PIN=6
|
|
GPIO_PATH="/sys/class/gpio/gpio$GPIO_PIN"
|
|
|
|
case "$1" in
|
|
external)
|
|
echo $GPIO_PIN > /sys/class/gpio/export
|
|
echo out > $GPIO_PATH/direction
|
|
echo 1 > $GPIO_PATH/value
|
|
;;
|
|
internal)
|
|
echo $GPIO_PIN > /sys/class/gpio/export
|
|
echo out > $GPIO_PATH/direction
|
|
echo 0 > $GPIO_PATH/value
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {external|internal}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|