Created
June 29, 2020 05:22
-
-
Save futureshocked/f76ad0de29de7819d6d5430e22fd5b35 to your computer and use it in GitHub Desktop.
This sketch will initialise the long counter in address 0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This sketch will initialise the long | |
// counter in 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); | |
} | |
EEPROM.writeULong(addr, 0); // Best use a seperate script to initialise the EEPROM | |
EEPROM.commit(); | |
Serial.println("Cleared EEPROM at address 0"); | |
Serial.println(); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment