mraa  2.0.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
libmraa - Low Level Skeleton Library for Communication on GNU/Linux platforms

Libmraa is a C/C++ library with bindings to Java, Python and JavaScript to interface with the I/O on Galileo, Edison & other platforms, with a structured and sane API where port names/numbering matches the board that you are on. Use of libmraa does not tie you to specific hardware with board detection done at runtime you can create portable code that will work across the supported platforms.

The intent is to make it easier for developers and sensor manufacturers to map their sensors & actuators on top of supported hardware and to allow control of low level communication protocol by high level languages & constructs.


These interfaces allow you to interact with all libmraa functionality. The Java classes directly wrap the C/C++ API and provide a near 1:1 mapping of functionality.

C API Modules Java API Classes
gpio Gpio class
led Led class
i2c I2c class
aio Aio class
pwm Pwm class
spi Spi class
uart Uart class
common mraa class

Hello Mraa

import mraa.Dir;
import mraa.Gpio;
import mraa.mraa;
import mraa.Platform;
import mraa.Result;
public class HelloEdison {
static {
try {
} catch (UnsatisfiedLinkError e) {
"Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
public static void main(String argv[]) {
Platform platform = mraa.getPlatformType();
if (platform != Platform.INTEL_EDISON_FAB_C) {
System.err.println("Error: This program can only be run on edison");
* MRAA_INTEL_EDISON_GP182 == 0, so this will initialise pin0 on arduino,
* which is hardware GPIO 130 and not 182
* We set the owner to false here, this makes sure that we do not close the
* gpio from sysfs in mraa_gpio_close meaning it will stay as an output and
* we will not always transition from 0->1 as gpio182 as output has the
* default position of '0'. Note that the value could change as a result of
* a mraa_gpio_dir however meaning we always go from 0->1 or 1->0
Gpio gpio182 = new Gpio(IntelEdison.INTEL_EDISON_GP182.swigValue(), false);
int val =;
System.out.println(String.format("GPIO%d (mraa pin %d) was: %d, will set to %d\n", 182,
gpio182.getPin(), val, val == 0 ? 1 : 0));
gpio182.write(val == 0 ? 1 : 0);

Supported platforms

Specific platform information for supported platforms is documented here:


Sometimes it just doesn't want to work, let us try and help you, you can file issues in github or join us in #mraa on freenode IRC, hang around for a little while because we're not necessarily on 24/7, but we'll get back to you! Have a glance at our Debugging libmraa page too


More information on compiling is Building libmraa page.


Please see the Contributing to libmraa page, the libmraa Internals page may also be of use.

API Changelog

Version Changelog here.