Permalink
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (39 sloc) 1.22 KB

Compass - HMC6352

Breadboard for "Compass - HMC6352"

docs/breadboard/compass-hmc6352.png

Fritzing diagram: docs/breadboard/compass-hmc6352.fzz

 

Run this example from the command line with:

node eg/compass-hmc6352.js
var five = require("../");
var board = new five.Board();

board.on("ready", function() {

  var compass = new five.Compass({
    controller: "HMC6352"
  });

  compass.on("change", function() {
    console.log("change");
    console.log("  heading : ", Math.floor(this.heading));
    console.log("  bearing : ", this.bearing.name);
    console.log("--------------------------------------");
  });

  compass.on("data", function() {
    console.log("  heading : ", Math.floor(this.heading));
    console.log("  bearing : ", this.bearing.name);
    console.log("--------------------------------------");
  });
});

 

License

Copyright (c) 2012-2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2015-2018 The Johnny-Five Contributors Licensed under the MIT license.