
The API has been changed in some cases - see the apichanges.md document. In addition, this driver uses a new upm_vectortypes.i SWIG interface file to provide a mechanism for methods that return a vector of floats and ints instead of a pointer to an array. This works much nicer than C array pointers, and results in Python/JS/Java code that looks much more "natural" to the language in use. The Python, JS, and Java examples have been changed to use these methods. Support for the "old" C-style pointer methods are still provided for backward compatibility with existing code. As an example - to retrieve the x, y, and z data for Euler Angles from the bno055, the original python code would look something like: ... x = sensorObj.new_floatp() y = sensorObj.new_floatp() z = sensorObj.new_floatp() ... sensor.getEulerAngles(x, y, z) ... print("Euler: Heading:", sensorObj.floatp_value(x), end=' ') print(" Roll:", sensorObj.floatp_value(y), end=' ') ... Now the equivalent code is simply: floatData = sensor.getEulerAngles() print("Euler: Heading:", floatData[0], ... print(" Roll:", floatData[1], end=' ') ... Additionally, interrupt handling for Java is now implemented completely in the C++ header file now rather than the .cxx file, so no special SWIG processing is required anymore. See Issue #518 . Signed-off-by: Jon Trulson <jtrulson@ics.com>
UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
The UPM repository provides software drivers for a wide variety of commonly used sensors and actuators. These software drivers interact with the underlying hardware platform (or microcontroller), as well as with the attached sensors, through calls to MRAA APIs.
These packages contain sources for the respective UPM modules and will compile locally on the target using node-gyp when installed. They support Node.js 0.10 or newer.
Installing
The UPM modules have a hard dependency on MRAA, thus you will have to install
it first. Also, make sure Node can find MRAA by updating the NODE_PATH
variable if necessary. A global installation is preferred:
npm install mraa -g
After this, to install a UPM module using npm simply type:
npm install jsupm_<module-name> -g
Usage
Unfortunately, due to the way node-gyp builds MRAA and UPM, the platform initialization hooks are lost. This means you will have to do it manually, and require MRAA before you load a UPM module:
require('mraa');
var lib = require('jsupm_<module-name>');
Supported Sensors
The full list is available on Intel® IoT Developer Zone.
IDE Integration
Intel® XDK IoT Edition is the recommended IDE for Node.js development. Visit the Intel® Developer Zone IDE page for more information on how to get started.
Building UPM
See building documentation here.
Making your own UPM module
Our porting link has more information on making new UPM modules. Also check out our main Github page as we do have some guidelines if you would like to contribute your modules to the library.
API Documentation
Our Node.js documentation pages are hosted here. For other supported languages and their APIs please visit our main Github page.
API Compatibility
Even if we try our best not to, every once in a while we are forced to modify our API in a way that will break backwards compatibility. If you find yourself unable to run code that was working fine before a library update, make sure you check the API changes section first.
Changelog
Version changelog here.
Known Limitations
List of known limitations here.