Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A small library project to work with beaglebone input/output IO in C
Shell C
Branch: master
Failed to load latest commit information.
AUTHORS gpio mem support by Brady Marks, experimental

Beaglebone I/O

A small library to support working with input and output pins on the beaglebone ( It comes together slowly and is largely not tested yet. It is an experimatel project for

  • understanding the beaglebone hardware
  • setting up C projects with autoconf
  • writing the build system

In the end it shall be fairly highlevel and mimic the behaviour of the Arduino Language and bonescript, the node.js implementation of the beaglebone.

The API is far from stable!


Clone the repository (or if you want to contribute fork the repository first and clone your own):

BONE:~/projects# git clone git://

Cloning into beagleboneIO...

cd into the beagleboneIO directory and invoke configure. Use a prefix where to install the binaries and libraries.

BONE:~/projects# cd beagleboneIO/
BONE:~/projects/beagleboneIO# ./configure --prefix=/opt/local
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk

As an alternative one can use MMAP enabled GPIO pins using, which is working faster

BONE:~/projects/beagleboneIO# ./configure --prefix=/opt/local -enable-gpiomem=yes

Compile the sourcecode

BONE:~/projects/beagleboneIO# make

As root:

BONE:~/projects/beagleboneIO# make install

Set 2 environment variables to include the path to executables and shared libries, resulting in something like this:

BONE:~/projects/beagleboneIO# echo $LD_LIBRARY_PATH 
BONE:~/projects/beagleboneIO# echo $PATH

There are two little helper programms available:

BONE:~/projects/beagleboneIO# digitalWrite --help
digitalWrite --pin <pin> --value <value>
    <pin>   e.g. P8_45
    <value> 0 = LOW, 1 = HIGH

BONE:~/projects/beagleboneIO# digitalWrite --pin P8_4 --value 1
BONE:~/projects/beagleboneIO# digitalWrite --pin P8_4 --value 0


BONE:~/projects/beagleboneIO# analogRead --help
analogRead --pin <pin>
    <pin>   an analog pin number, Arduino style, e.g. 0, 1, ...
            maps to the according AIN pin of the beaglebone.
            the value is written to stdoutn
BONE:~/projects/beagleboneIO# analogRead --pin 4


A super simple use of the library:

In order to write your own programms, currently inspect beaglebone.h and have a look at the source files for analogRead and digitalWrite. The whole API is subject to change though. Please CONTRIBUTE by submitting feature request and bugs and code. Hack on!


Stuff to do urgently:

  • add PWM support (partly done, see pwm_clock)
  • try it out
  • reorganize the project structure
  • I2C support
  • testing and bug reporting
  • functions inspired by
  • a delay function other than sleep
  • support for Serial communication using /dev/ttyOx / /dev/cuXXX? (started)
Something went wrong with that request. Please try again.