set gpio direction

This commit is contained in:
Simon Wörner
2017-03-30 17:09:04 +02:00
parent 69fc6e0797
commit d7c15c5c77

View File

@@ -14,6 +14,12 @@ function unexport_port() {
echo "${port}" > /sys/class/gpio/unexport
}
function set_direction() {
port="${1}"
value="${2}"
echo "${value}" > "/sys/class/gpio/gpio${port}/direction"
}
function set_value() {
port="${1}"
value="${2}"
@@ -34,6 +40,7 @@ trap 'unexport_port "${GPIO_PORT}"' EXIT
# init GPIO port
export_port "${GPIO_PORT}"
set_direction "${GPIO_PORT}" "out"
# loop led on/off
while true; do