This tutorial will show you the basics of controlling a GPIO pin on the Beaglebone Black for digital output. It will explain how to export the GPIO pins ready for use, and how to control the pins by manipulating the file system. Later tutorials will build upon this to control the GPIO pins from a programming language such as Python or C++.
To follow along you will need the following
We could drive the LED directly from one of the Beaglebone's GPIO pins, but we could risk damaging the Beaglebone if too much current were to flow through the GPIO pin. So to be safe we will drive a transistor from the beaglebone and drive the LED from the transistor. The LED will use a seperate power supply, in our example a 6volt battery pack.
First we will connect up the circuit as per the diagram here:
Next we will export the pin 12 ready for use.
echo 60 > /sys/class/gpio/export
Now we can turn on the LED by setting pin 12 to high.
echo high > /sys/class/gpio/gpio60/direction
and switch it off again by setting the pin to low
echo low > /sys/class/gpio/gpio60/direction
And that's it. We can now control the GPIO pin by writing either high or low to the direction file within the file system. Later tutorials will build upon this by manipulating the file system from a programming language such as Python or C++
By sure to add your comments below.