Skip to content

Instantly share code, notes, and snippets.

@bathtimefish
Created May 10, 2015 05:58
Show Gist options
  • Save bathtimefish/55cc8ef0998d44cc0fb3 to your computer and use it in GitHub Desktop.
Save bathtimefish/55cc8ef0998d44cc0fb3 to your computer and use it in GitHub Desktop.
Tessel 加速度センサーモジュールの値を取得する
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