Skip to content

Latest commit

 

History

History
74 lines (39 loc) · 1.24 KB

compass-hmc6352.md

File metadata and controls

74 lines (39 loc) · 1.24 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("headingchange", function() {
    console.log("headingchange");
    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, 2013, 2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2016 The Johnny-Five Contributors Licensed under the MIT license.