How to send env data over BLE every 15 minutes?


#1

Hi! I correctly uploaded and installed Espruino firmware inside my Ruuvitag, then using the IDE on browser I started coding. My goal is to publish environmental data every 15 minutes. Because the original behaviour post over BLE too much data every seconds.

What is the function to post over BLE?

Here is my code:

// require Ruuvitag library
var Ruuvitag = require("Ruuvitag");
// declare minutes
var minutes = 15;

// function required for start code every reboot (saved on ROM)
function onInit() {
  // enable environment data
  Ruuvitag.setEnvOn(true);
  // disable accelerometer data
  Ruuvitag.setAccelOn(false);

  // publish data every 15 minutes over BLE
  setInterval(function() {
    // send data over BLE ?!?!?!
  }, 1000*minutes);
}

Thank you very much!


#2

This was discussed on Slack, but I’ll follow up here for the benefit of those who run into this thread.

The approach is to store the updated state of sensor into a global variable and send the data held in variable with a timer. Let us know how it works :slight_smile: