• I just wanted to know if it is possible to log data from RuvviTag into a CSV file using Espruino. If any code is available it would help a lot.

    This is the code I'm using to print values on the console

    const period = 30*60*1000; // milliseconds (every 30 minutes)
    const length = 200; // number of records (for 100 hours / 4 days)
    
    var ruuvi = require("Ruuvitag");
    var records = [];
    
    function log() {
      ruuvi.setEnvOn(true);
      if (records.unshift({time:getTime(),temp:ruuvi.getEnvData().temp}) > length){
        records.pop();
      }
      ruuvi.setEnvOn(false);
    }
    
    function getData() {
      records.forEach( function(d,i) {
        console.log(i+"\t"+ d.temp +"\t"+ (getTime()-d.time));
      });
    }
    
    ruuvi.setAccelOn(true);
    setInterval(log, period);
    
About

Avatar for user115800 @user115800 started