mraa  1.8.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Mock platform

Mocking capability allows libmraa user to work with the library without any real hardware available. Enabling this requires library recompilation with architecture override (see Building section below). When mock is enabled, library simulates actual HW operations at the backend so that for the application it looks like a usual board. Being implemented at the backend, the functionality is available in all language bindings libmraa supports.

Board configuration

This feature is yet in the experimental mode and not all functionality is available. Right now we simulate a single generic board with:

We plan to develop it further and all contributions are more than welcome. See our Contributing to libmraa page for more information.

See the table below for pin layout and features

MRAA Number Pin Name Notes
0 GPIO0 GPIO pin, no muxing, no ISR
1 ADC0 AIO pin, returns random value on read
2 I2C0SDA SDA pin for I2C0 bus
3 I2C0SCL SCL pin for I2C0 bus
4 SPI0CS CS pin for SPI0 bus
5 SPI0MOSI MOSI pin for SPI0 bus
6 SPI0MISO MISO pin for SPI0 bus
7 SPI0SCLK SCLK pin for SPI0 bus
8 UART0RX RX pin for UART0 port
9 UART0TX TX pin for UART0 port


Generally all the building steps are the same as listed in the main Building libmraa guide, you just need to set some specific CMake options.


To build under Linux, follow standard instructions, just make sure to set the -DBUILDARCH="MOCK" CMake option.


Mocking capability allows us to build and use libmraa under Windows. That helps if you e.g. don't want to leave your customary Windows-based Python IDE, but want to develop libmraa-based programs.

Building Node.js bindings was not yet tested under Windows as MSYS2 does not have a ready-made package. Java was not tested either.


You'll need the following to build libmraa under Windows:


The procedure is conceptually the same as under Linux - you first need to run CMake with specific options to generate makefiles and then run make to build everything.

Note: To have autocompletion in Python IDE, just point it to MSYS2's Python and make sure to specify any additional paths pointing to site-packages dir with mraa module if IDE requires that ("Interpreter Paths" in PyCharm). With the above settings the module will be installed into /usr/local/lib/python2.7/site-packages and the libmraa itself - into /usr/local/bin.