Advertisement
Grommish

Untitled

Sep 1st, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #!/bin/sh
  2. GPIOCHIP=0
  3. BASE=$(cat /sys/class/gpio/gpiochip${GPIOCHIP}/base)
  4. NGPIO=$(cat /sys/class/gpio/gpiochip${GPIOCHIP}/ngpio)
  5. max=$(($BASE+$NGPIO))
  6. gpio=$BASE
  7. while [ $gpio -lt $max ] ; do
  8. echo $gpio > /sys/class/gpio/export
  9. [ -d /sys/class/gpio/gpio${gpio} ] && {
  10. echo in > /sys/class/gpio/gpio${gpio}/direction
  11. echo "[GPIO${gpio}] value $(cat /sys/class/gpio/gpio${gpio}/value)"
  12. echo ${gpio} > /sys/class/gpio/unexport
  13. }
  14. gpio=$((gpio+1))
  15. done
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement