Permalink
017e5f1 Jun 8, 2018
4 contributors

Users who have contributed to this file

@rwaldron @Resseguie @dtex @BrianGenisio
75 lines (39 sloc) 1.23 KB

Compass - HMC5883L

Breadboard for "Compass - HMC5883L"

docs/breadboard/compass-hmc5883l.png

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

 

Run this example from the command line with:

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

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

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

  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.