Using /etc/rc.local for startup settings in Beaglebone Black (BBB)/Raspberry Pi

debian@beaglebone:/$ nano /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#export gpio, configure pin for output and set permissions to allow all users
#GPIO PIN SETUP
echo 66 > /sys/class/gpio/export
chmod 666 /sys/class/gpio/gpio66/value
chmod 666 /sys/class/gpio/gpio66/direction
echo out > /sys/class/gpio/gpio66/direction
echo 67 > /sys/class/gpio/export
chmod 666 /sys/class/gpio/gpio67/value
chmod 666 /sys/class/gpio/gpio67/direction
echo out > /sys/class/gpio/gpio67/direction

echo 68 > /sys/class/gpio/export
chmod 666 /sys/class/gpio/gpio68/value
chmod 666 /sys/class/gpio/gpio68/direction
echo out > /sys/class/gpio/gpio68/direction
#GPIO PIN SETUP END

#PWM PIN SETUP
chmod 666 /sys/devices/ocp.*/pwm_test_P9_14.*/duty
chmod 666 /sys/devices/ocp.*/pwm_test_P9_16.*/duty
chmod 666 /sys/devices/ocp.*/pwm_test_P9_29.*/duty
chmod 666 /sys/devices/ocp.*/pwm_test_P9_14.*/period
chmod 666 /sys/devices/ocp.*/pwm_test_P9_16.*/period
chmod 666 /sys/devices/ocp.*/pwm_test_P9_29.*/period
#PWN PIN SETUP END
exit 0
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s