Evaluating Intel’s Mraa Library

With the aggressive move by Intel to enter the hacker maker space, they have “spawn” out a bunch of starter in a short amount of time, to make matters worst the boards are almost completely different from each other.

Luckily for us, the engineer in Intel has realize about the portability issue. Therefore they have provided us with a simple Library to do what we like to do best. Physically drive and evaluate input from the real world.

We will take a look at the basic operations of input and output using the Intel’s mraa library.

MRAA (pronounced em-rah)

Why we should use it?

  • The mraa library is designed to smooth out the differences between hardware. In this case hardware includes the breakout board type as well as the CPU.
  • The Galileo as a Arduino board is complicated because some of the raw pins are used for more than one thing – they are multiplexed – and there is a lot of extra hardware connected to the raw pins for analog I/O for example.
  • Mraa provides a simple interface to this complicated mess and make it looks as if the Arduino “shield” I/O lines are simple GPIO lines.

Intel IoT distro provides mraa library which can be used for C/C++ development.

Documentation could be found at
http://iotdk.intel.com/docs/master/mraa/

Let’s start by verifying the version of the Mraa library

#include <stdio.h>
#include <syslog.h>
#include <mraa.h>

int main(int argc, char **argv)
{

mraa_result_t ret;
ret = mraa_set_log_level(LOG_DEBUG);
fprintf(stdout, “Mraa version: %s\n”, mraa_get_version());
mraa_deinit();
return ret;
}

Compile the code using the Galileo toolchain:

$ gcc -lmraa —o testversion testversion.c
Next, we will try to execute the resulting binaries?

$ ./testversion

Leave A Comment?