Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- GPIOCHIP=0
- BASE=$(cat /sys/class/gpio/gpiochip${GPIOCHIP}/base)
- NGPIO=$(cat /sys/class/gpio/gpiochip${GPIOCHIP}/ngpio)
- max=$(($BASE+$NGPIO))
- gpio=$BASE
- while [ $gpio -lt $max ] ; do
- echo $gpio > /sys/class/gpio/export
- [ -d /sys/class/gpio/gpio${gpio} ] && {
- echo in > /sys/class/gpio/gpio${gpio}/direction
- echo "[GPIO${gpio}] value $(cat /sys/class/gpio/gpio${gpio}/value)"
- echo ${gpio} > /sys/class/gpio/unexport
- }
- gpio=$((gpio+1))
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement