From d7c15c5c7798ed4705e5c15b9e1fc83209b8519a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=B6rner?= Date: Thu, 30 Mar 2017 17:09:04 +0200 Subject: [PATCH] set gpio direction --- V1/led.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/V1/led.sh b/V1/led.sh index 45fade7..a0033e7 100755 --- a/V1/led.sh +++ b/V1/led.sh @@ -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