Article / Updated 03-26-2016
Following is a handy reference that you can use to control and access your BeagleBone’s general purpose input/output (GPIOs) with the file system, BoneScript, and Python. Controlling the GPIO with the file system You can use the following commands to control the GPIO with the file system. Exporting a pin: echo 40 > /sys/class/gpio/export Setting a pin OUTPUT: echo out > /sys/class/gpio/gpio40/direction Writing a pin HIGH: echo 1 > /sys/class/gpio/gpio40/value Writing a pin LOW: echo 0 > /sys/class/gpio/gpio40/value Setting a pin INPUT: echo in > /sys/class/gpio/gpio40/direction Reading the value from an INPUT pin (returns 1 for HIGH and 0 for LOW): cat /sys/class/gpio/gpio40/value Controlling the GPIO with BoneScript You can use the following BoneScript commands to control the GPIO.