Fun with UBB: libubb for GPIO access

Werner Almesberger werner at almesberger.net
Mon Dec 31 08:12:51 EST 2012


To make it a bit easier to use UBB, I've written a library that
takes care of getting access to UBB and controlling the GPIOs.
The library lives here:

http://projects.qi-hardware.com/index.php/p/ben-blinkenlights/source/tree/master/libubb

There's even a README:

http://projects.qi-hardware.com/index.php/p/ben-blinkenlights/source/tree/master/libubb/README

A very simple program using libubb (outputs a square wave of
nominally 1 Hz on the DAT1 line) could look like this:

#include <unistd.h>
#include <ubb/ubb.h>

int main(void)
{
	ubb_open(0);
	OUT(UBB_DAT1);

	while (1) {
		SET(UBB_DAT1);
		usleep(500*1000);
		CLR(UBB_DAT1);
		usleep(500*1000);
	}
}

The README describes more details. 

- Werner




More information about the discussion mailing list


interactive