Created
May 10, 2015 05:58
-
-
Save bathtimefish/55cc8ef0998d44cc0fb3 to your computer and use it in GitHub Desktop.
Tessel 加速度センサーモジュールの値を取得する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tessel = require('tessel'); | |
var accel = require('accel-mma84').use(tessel.port['A']); // Attach 'accel-mma84' module to Port A | |
// Initialize the accelerometer. | |
accel.on('ready', function () { | |
// Stream accelerometer data | |
accel.on('data', function (xyz) { | |
console.log('x:', xyz[0].toFixed(2), 'y:', xyz[1].toFixed(2), 'z:', xyz[2].toFixed(2)); | |
}); | |
}); | |
accel.on('error', function(err){ console.log('Error:', err); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment