Guest
Public paste!

binblog

By: a guest | Oct 4th, 2008 | Syntax: Bash | Size: 0.63 KB | Hits: 782 | Expires: Never
Copy text to clipboard
  1. #!/bin/sh
  2.  
  3. LED=$1
  4. STATE=$2
  5.  
  6. case "$LED" in
  7.         "1")
  8.                 GPIO=6
  9.                 ;;
  10.         "2")
  11.                 GPIO=25
  12.                 ;;
  13.         "3")
  14.                 GPIO=27
  15.                 ;;
  16.         *)
  17.                 echo 'Usage: led <1/2/3> <on/off>'
  18.                 exit 1
  19.                 ;;
  20. esac
  21.  
  22. gpioctl -q -c $GPIO out iout
  23.  
  24. case "$STATE" in
  25.         "on")
  26.                 gpioctl -q $GPIO 1
  27.                 ;;
  28.         "off")
  29.                 gpioctl -q $GPIO 0
  30.                 ;;
  31.         *)
  32.                 echo 'Usage: led <1/2/3> <on/off>'
  33.                 exit 1
  34.                 ;;
  35. esac