sleepBlink Example – eS2 Pro 2018-02-21T11:33:03+00:00
  1. Home
  2. Knowledge Base
  3. energyShield 2 Pro
  4. sleepBlink Example – eS2 Pro

This is an example sketch designed to demonstrate the power sleep functionality of the energyShield 2 Pro. In this example, the sketch blinks an LED three times and then commands the energyShield to turn the power off for four seconds. After four seconds the energyShield re-enables the power and the sketch restarts.

For more information or to download the Arduino Library check out the eS2 Pro Arduino Library Reference.

  sleepBlink - energyShield2                              
  by NightShade Electronics V1.0                          
  This sketch blinks the pin 13 LED three times and       
  sleeps for 4 seconds. These results is an approximate   
  20% duty cycle for power comsumption. That means that   
  this blink sketck will run 5 times as long as the       
  standard blink sketch will run on the same battery.         
  Created by Aaron D. Liebold                             
  on January 30, 2017

  Distributed under the MIT license
  Copyright 2017 NightShade Electronics         

// Includes enegyShield2 library files
#include <NS_energyShield2.h>
#include <NS_eS2_Utilities.h>

// Defines NS_energyShield2 class object "es2"
NS_energyShield2 es2;

void setup() {
  es2.begin(); // Initialize energyShield
  es2.setVMPP(-1, 1); // Disable VMPP regulation to allow charging from any source, 7V - 23V

  pinMode(13, OUTPUT);

void loop() {
  // Blinks three times

  // Sleeps power for 4 seconds

// Blinks LED
void blink() {
  digitalWrite(13, HIGH);
  digitalWrite(13, LOW);

Was this article helpful?

Related Articles