mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
curieimu: Adds examples for both JS and Python that load MRAA Firmata subplatform
Signed-off-by: deadprogram <ron@hybridgroup.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
1b8cb1361c
commit
a35e58c54c
@ -24,19 +24,24 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
var mraa = require('mraa');
|
||||
console.log('MRAA Version: ' + mraa.getVersion());
|
||||
|
||||
// open connection to Firmata
|
||||
mraa.addSubplatform(mraa.GENERIC_FIRMATA, "/dev/ttyACM0");
|
||||
|
||||
var curieImu = require('jsupm_curieimu');
|
||||
var myCurie = new curieImu.CurieImu();
|
||||
|
||||
var outputStr;
|
||||
var myInterval = setInterval(function()
|
||||
{
|
||||
// get accelerometer readings
|
||||
curieImu.updateAccel();
|
||||
outputStr = "accel: x " + curieImu.getAccelX()
|
||||
+ " - y " + curieImu.getAccelY()
|
||||
+ " - z " + curieImu.getAccelZ();
|
||||
myCurie.updateAccel();
|
||||
outputStr = "accel: x " + myCurie.getAccelX()
|
||||
+ " - y " + myCurie.getAccelY()
|
||||
+ " - z " + myCurie.getAccelZ();
|
||||
console.log(outputStr);
|
||||
console.log(" ");
|
||||
}, 1000);
|
||||
}, 500);
|
||||
|
||||
// Print message when exiting
|
||||
process.on('SIGINT', function()
|
||||
|
Reference in New Issue
Block a user