Breadboard for "Compass - MAG3110 on Tessel 2"


Fritzing diagram: compass-MAG3110-tessel.fzz


Run this example from the command line with:

node eg/compass-MAG3110-tessel.js
var Tessel = require("tessel-io");
var five = require("../");
var board = new five.Board({
  io: new Tessel()

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

  var compass = new five.Compass({
    controller: "MAG3110",
    // Optionally pre-load the offsets
    offsets: {
      x: [-819, -335],
      y: [702, 1182],
      z: [-293, -13],

  compass.on("calibrated", function(offsets) {
    // Use this data with the optional "offsets" property above
    console.log("calibrated:", offsets);

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


Component Classes in this example:

Hi! The Johnny-Five community is building new projects every day. We made this newsletter to tell you about what's new, what's good, and what's next for Open Source robotics. Join us in exploring what we can make together.

Fork me on GitHub