Regular execution

For example, let's say you only measure the temperature once a day and store it in the cloud. obniz device is up and running once a day is enough, and there is nothing to do during the lumpy hours.

By Sleeping in this do-nothing time, you can reduce battery consumption. And after a period of time, it will automatically start up to measure the temperature again.


obniz.onconnect = async function(){
  var tempsens = obniz.wired("LM61", { gnd:0 , output:1, vcc:2});
  var temp = await tempsens.getWait();
  console.log(temp);  //output tempeature

  obniz.sleepMinute(60*24); // one day sleep
}

sleepMinute allows you to sleep for a specified amount of time. the connection to obniz will be automatically severed and the system will enter the sleep state. The state of the obnizBoard 1Y will look the same as it did when it was not connected to the power supply, and there will be nothing on the screen It will not be displayed.

ObnizBoard 1Y in Sleep

After the specified time has passed (24 hours in this case), it will automatically release the sleep state, make a wifi connection and call the program onconnect.