• Hi! Yes, no problem at all.

    For something really simple, you can do:

    var data = [];
    
    function storeData() {
      var newData = E.getTemperature(); // for instance...
      data.push(newData);
    }
    
    setInterval(storeData, 10*60*1000); // call every 10 minutes
    

    If you upload that, after 10 minutes you'll have your first data element (the temperature), then another 10 minutes later, the next, etc.

    You can read the data just by typing data and enter on the left-hand side of the IDE. However once you've got quite a bit of data, it'll be too much to fit on a line.

    If you type data.forEach(a=>print(a)) then it'll print all the data items, one per line - which you could copy & paste into a spreadsheet. You could also turn that into a function that you can call:

    function getData() {
      data.forEach(a=>print(a));
    }
    

    To clear out all the old data you can also just write data=[].

    This way's simple but isn't very efficient with memory so you'll only be able to store around 1000 data items (still, that's 150 hours recording every 10 minutes).

    So... to get that on your mobile, you can run the same code on https://www.espruino.com/ide/ on an Android phone (or an iPhone with the WebBLE app).

    Or... you could write your own Web Bluetooth webpage. This one will grab the data and just print it to the page:

    <html>
     <head>
     </head>
     <body>
      <script src="https://www.puck-js.com/puck.js"></­script>
      <script>
        function getData() {
          Puck.eval('data', function(data) { 
            document.write(data.join('<br/>')); 
          });
        }
      </script>
      <button onclick="getData()">Get Data</button>
     </body>
    </html>
    

    There's some more info on using Web Bluetooth pages here: http://www.espruino.com/Puck.js+Web+Blue­tooth

    But once you have it loaded onto the page you could (for instance) display it in some fancier way, allow it to be downloaded, or maybe publish the data to Google Sheets.

About

Avatar for Gordon @Gordon started