• Hmm, that's an interesting problem actually. This should work:

    var Ruuvitag = require('Ruuvitag');
    function onInit() {
      setTimeout(function() {
        Ruuvitag.setEnvOn(true);
      }, 50);
      setInterval(function() {
        console.log(Ruuvitag.getEnvData());
      }, 5000);
    }
    

    or this should work:

    var Ruuvitag = require('Ruuvitag');
    E.on('init', function() {
      Ruuvitag.setEnvOn(true);
      setInterval(function() {
        console.log(Ruuvitag.getEnvData());
      }, 5000);
    });
    

    but it's to do with the order of execution on initialisation, where onInit actually gets called before everything else. I'll change that for the next version of the firmware though.

About

Avatar for Gordon @Gordon started