johnny-five-electron
Version:
Temporary fork to support Electron (to be deprecated)
39 lines (35 loc) • 1.24 kB
JavaScript
var five = require("../lib/johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
io: new Edison()
});
board.on("ready", function() {
// Plug the MMA7660 Accelerometer module
// into an I2C jack
var acceleration = new five.Accelerometer({
controller: "MMA7660"
});
acceleration.on("change", function() {
console.log("accelerometer");
console.log(" x : ", this.x);
console.log(" y : ", this.y);
console.log(" z : ", this.z);
console.log(" pitch : ", this.pitch);
console.log(" roll : ", this.roll);
console.log(" acceleration : ", this.acceleration);
console.log(" inclination : ", this.inclination);
console.log(" orientation : ", this.orientation);
console.log("--------------------------------------");
});
});
// @markdown
// For this program, you'll need:
//
// 
//
// 
//
// 
//
//
// @markdown