set gpio direction
This commit is contained in:
@@ -14,6 +14,12 @@ function unexport_port() {
|
|||||||
echo "${port}" > /sys/class/gpio/unexport
|
echo "${port}" > /sys/class/gpio/unexport
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_direction() {
|
||||||
|
port="${1}"
|
||||||
|
value="${2}"
|
||||||
|
echo "${value}" > "/sys/class/gpio/gpio${port}/direction"
|
||||||
|
}
|
||||||
|
|
||||||
function set_value() {
|
function set_value() {
|
||||||
port="${1}"
|
port="${1}"
|
||||||
value="${2}"
|
value="${2}"
|
||||||
@@ -34,6 +40,7 @@ trap 'unexport_port "${GPIO_PORT}"' EXIT
|
|||||||
|
|
||||||
# init GPIO port
|
# init GPIO port
|
||||||
export_port "${GPIO_PORT}"
|
export_port "${GPIO_PORT}"
|
||||||
|
set_direction "${GPIO_PORT}" "out"
|
||||||
|
|
||||||
# loop led on/off
|
# loop led on/off
|
||||||
while true; do
|
while true; do
|
||||||
|
|||||||
Reference in New Issue
Block a user