mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-28 20:11:53 +08:00
18 lines
271 B
Bash
Executable File
18 lines
271 B
Bash
Executable File
#!/bin/sh
|
|
|
|
PIN=$1
|
|
VALUE=$2
|
|
|
|
PIN_FILE=/sys/class/gpio/gpio$PIN
|
|
|
|
if [ -z "$PIN" -o -z "$VALUE" ]; then
|
|
exit 1
|
|
fi
|
|
|
|
echo $PIN >/sys/class/gpio/export
|
|
|
|
if [ $(cat $PIN_FILE/direction) = "out" ]; then
|
|
echo $VALUE >$PIN_FILE/value
|
|
fi
|
|
|
|
echo $PIN >/sys/class/gpio/unexport |