This is an old revision of the document!

Sleep and Low Power

We want to collect data from sensors and then periodically send packets of data. When we do not want to do this at a high frequency, we have some dead times. This leads to high energy consumption, which can have a significant impact on the battery life of sparrow when it is powered by a battery.

You can download SleepLibrary code from here

Bellow you can see and example on how to use sleep library.

/* This is an example for SparrowVSleep library.
    You need to call SparrowV_SleepInit function.
    The funciton has 2 params.
    1st param: integer (> 1 second, greater than 1 second) (represent time in seconds, how long the board will sleep)
    2nd param: bool (true - with data retention, false - with no data retention)
               In case of no data retention the board can sleep max 8 secons and it will
    reboot after time end.
#include <SparrowVsleep.h>
void setup() {
void loop() {
  // put your main code here, to run repeatedly:
  Serial. println("****************************");
  //sleep for 25 seconds with data retention
  SparrowV_SleepInit(25, true);
  Serial. println("****************************");
  Serial. println();