johnny-five
Version:
The JavaScript Robotics and Hardware Programming Framework. Use with: Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, Raspberry Pi, Spark Core, TI Launchpad and more!
17 lines (13 loc) • 397 B
JavaScript
var five = require("../lib/johnny-five.js");
var board = new five.Board();
board.on("ready", function() {
// Create a new `Gyro` hardware instance.
var gyro = new five.Gyro({
pins: ["I0", "I1"],
sensitivity: 0.67
});
gyro.on("change", function() {
console.log("X raw: %d rate: %d", this.x, this.rate.x);
console.log("Y raw: %d rate: %d", this.y, this.rate.y);
});
});