• Yes, as far as 'magOn' is concerned it thinks the magnetometer is still on because the power to it has always stayed on. I'm wondering what the best way of handling that is...

    I could make magOn read back the data in the magnetometer, which would help it know if the magnetometer had got reset, but I wonder of that really helps. Just Puck.magOff();Puck.magOn(); would fix it.

    You could do:

    var magReadings = 0;
    setInterval(function() {
      if (!magReadings) { Puck.magOff();Puck.magOn(5); }
      magReadings=0;
    }, 1000);
    Puck.magOn(5);
    Puck.on("mag", function() {magReadings++})
    

    Potentially I could do that internally, but then it ends up using up more battery power in all cases.

    In your case, if it always stops working after 5 samples it's not going to help you a great deal.

About

Avatar for Gordon @Gordon started