-
-
Save rwaldron/5769645 to your computer and use it in GitHub Desktop.
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 five = require("./lib/johnny-five.js"), | |
board, slider; | |
board = new five.Board(); | |
board.on("ready", function() { | |
var accel = new five.Accelerometer({ | |
pins: [ "I0", "I1" ], | |
freq: 100 | |
}); | |
// Create a new `slider` hardware instance. | |
slider = new five.Sensor("I3"); | |
// Fires when value of sensor changes | |
// | |
slider.scale([ 0, 1 ]).on("slide", function() { | |
accel.alpha = this.scaled; | |
}); | |
accel.on("acceleration", function(err, data) { | |
console.log(Math.abs(data.rough.x - data.smooth.x)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment