Skip to content

Instantly share code, notes, and snippets.

@futureshocked
Last active July 18, 2021 23:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save futureshocked/518cfd39c0a25ccc7d2b441edb03e6d2 to your computer and use it in GitHub Desktop.
Save futureshocked/518cfd39c0a25ccc7d2b441edb03e6d2 to your computer and use it in GitHub Desktop.
This sketch will read the long in EEPROM address 0.
// This sketch will read the long in EEPROM address 0.
// Written by Peter Dalmaris from Tech Explorations.
// Used to find out how long an ESP32 can last on a LiPo battery.
// https://techexplorations.com
#include "EEPROM.h"
int addr = 0;
#define EEPROM_SIZE 32
void setup() {
Serial.begin(115200);
Serial.println("start...");
if (!EEPROM.begin(EEPROM_SIZE))
{
Serial.println("failed to initialise EEPROM"); delay(1000000);
}
Serial.println(" bytes read from Flash . Count is:");
long count = EEPROM.readLong(addr);
Serial.print(count);
Serial.print(" ");
Serial.println();
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment