Skip to content

Instantly share code, notes, and snippets.

@chrismatthieu
Created May 11, 2016 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismatthieu/4840c90eb4c57b5dc684d69de27c365c to your computer and use it in GitHub Desktop.
Save chrismatthieu/4840c90eb4c57b5dc684d69de27c365c to your computer and use it in GitHub Desktop.
var tessel = require('tessel');
var accel = require('accel-mma84').use(tessel.port['B']);
var request = require('request');
// 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));
request.post('https://triggers.octoblu.com/flows/d583a11c-826d-468f-9d2f-37e83265e34c/triggers/44b68ea0-e7c0-11e5-9f26-a58a363cc0f4', {form:{xyz:xyz}})
});
});
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