Blink with Firmware on evive

Description
Learn how to access the evive firmware while running other code. This tutorial explains how to use the evive library to access the firmware at any time and make changes to the system.

Introduction

This tutorial explains how can we access evive firmware even when some other code is running on evive. To explain this feature of evive library an example of blinking an on board LED “M1”  on evive is taken. Here blinking is achieved by switching between code of glowing the bi color led at “M1” in two colors and firmware. Led stops changing its color as soon as firmware is opened and when we exit firmware led starts changing color again.

Flow of activity

  1. Make sure evive library is installed on Arduino IDE.
  2. Download the zip of evive from here and upload the code given below.
  3. The LED will start glowing in two colors.
  4. Press the navigation key and the LED will change to one color.
  5. Exit firmware by using the “Exit Firmware” option in the menu.
  6. The LED will start glowing in two colors again.

This example basically highlights the fact that we can access evive firmware anytime even when some other code is running on evive. Just one point necessary to be kept in mind is that evive library should be included in the code sketch.

Code

/* Here we are blinking bi-color LED "M1" of evive connected on Pin 28 and 29. 
 * Unlike basic blinking code that uses delay for blink action here blinking 
 * is achieved by switching between firmware and code of glowing LED.
 * Library of evive is included in code which makes this task possible. 
 * Intially LED glows in two colours namely red and green now as the 
 * navKey is center pressed we navigate to firmware and the uploaded code 
 * stops running hence led stops changing color for a while till we exit from the firmware
 * by using Exit from the menu. As we exit firmware the code to glow led in 
 * two colours starts again.In this code status bar is also shown for 
 * information related to battery level and variable voltage value.
 * 
 * Created by Nihar Shah.
 * This code is in public domain.
 * Explore more at https://thestempedia.com/tutorials/blink-with-firmware-on-evive
 */
 
#include <evive.h>            // Include evive library

void setup() {
  pinMode(LED28, OUTPUT);     // Set pin as output mode (LED28 = Pin 28)
  pinMode(LED29, OUTPUT);     // Set pin as output mode (LED29 = Pin 29)
  drawStatusBar();            // shows variable voltage value (VVR) and battery level
}

void loop() {
 //By center pressing navigation key evive Firmware opens.
  drawStatusBar();            // shows variable voltage value (VVR) and battery level
  digitalWrite(LED28, HIGH);  // glows led in green
  digitalWrite(LED29, LOW);
  delay(1000);                // wait for a second
  digitalWrite(LED29, HIGH);  // glows led in red
  digitalWrite(LED28, LOW);   
  delay(1000);                // wait for a second
}

Output


Carefully observe that before the navigation key is center pressed M1 led glows in red and orange color. As soon as the navigation key is center pressed the led stops changing its color and remains still and as soon as you exit the firmware LED starts changing its color again.

Conclusion

This tutorial has demonstrated how to access the evive firmware while running some other code on evive. It is important to remember that the evive library should be included in the code sketch for this feature to work. With this knowledge, users can access the evive firmware at any time and make changes to the system.

Table of Contents