Installation-gpio

This revision is from 2013/05/22 02:28. You can Restore it.

open

vim /etc/init.d/gpio

and paste

#!/bin/sh
### BEGIN INIT INFO
# Provides:        gpio
# Required-Start:  $local_fs $syslog
# Required-Stop:   $local_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:
# Short-Description: Start gpio
### END INIT INFO

echo "4" > /sys/class/gpio/export
echo "17" > /sys/class/gpio/export
echo "18" > /sys/class/gpio/export
echo "21" > /sys/class/gpio/export
echo "22" > /sys/class/gpio/export
echo "23" > /sys/class/gpio/export
echo "24" > /sys/class/gpio/export
echo "25" > /sys/class/gpio/export
echo "27" > /sys/class/gpio/export

echo "out" > /sys/class/gpio/gpio4/direction
echo "out" > /sys/class/gpio/gpio17/direction
echo "out" > /sys/class/gpio/gpio18/direction
echo "out" > /sys/class/gpio/gpio21/direction
echo "out" > /sys/class/gpio/gpio22/direction
echo "out" > /sys/class/gpio/gpio23/direction
echo "out" > /sys/class/gpio/gpio24/direction
echo "out" > /sys/class/gpio/gpio25/direction
echo "out" > /sys/class/gpio/gpio27/direction

chmod 666 /sys/class/gpio/gpio4/value
chmod 666 /sys/class/gpio/gpio17/value
chmod 666 /sys/class/gpio/gpio18/value
chmod 666 /sys/class/gpio/gpio21/value
chmod 666 /sys/class/gpio/gpio22/value
chmod 666 /sys/class/gpio/gpio23/value
chmod 666 /sys/class/gpio/gpio24/value
chmod 666 /sys/class/gpio/gpio25/value
chmod 666 /sys/class/gpio/gpio27/value

chmod 666 /sys/class/gpio/gpio4/direction
chmod 666 /sys/class/gpio/gpio17/direction
chmod 666 /sys/class/gpio/gpio18/direction
chmod 666 /sys/class/gpio/gpio21/direction
chmod 666 /sys/class/gpio/gpio22/direction
chmod 666 /sys/class/gpio/gpio23/direction
chmod 666 /sys/class/gpio/gpio24/direction
chmod 666 /sys/class/gpio/gpio25/direction
chmod 666 /sys/class/gpio/gpio27/direction

exit 0

enabled with

chmod 774 /etc/init.d/gpio
update-rc.d gpio defaults