http://elinux.org/RPi_Low-level_peripherals
# Set up GPIO 4 and set to output echo "4" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio4/direction # Set up GPIO 7 and set to input echo "7" > /sys/class/gpio/export echo "in" > /sys/class/gpio/gpio7/direction # Write output echo "1" > /sys/class/gpio/gpio4/value # Read from input cat /sys/class/gpio/gpio7/value # Clean up echo "4" > /sys/class/gpio/unexport echo "7" > /sys/class/gpio/unexport