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