46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
/*
|
|
powerCycleCounter.ino
|
|
|
|
Copyright (c) 2020 Dale Giancono. All rights reserved..
|
|
This file is a an application to demonstrte the abilities of the
|
|
ESPFlash Library. It uses an ESPFlashCounter instance to count
|
|
the number of times the ESP chip has had a power cycle/software reset.
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "ESPFlashCounter.h"
|
|
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
Serial.println("Starting");
|
|
/* Have to initialise before performing any SPIFFS operations*/
|
|
SPIFFS.begin();
|
|
|
|
ESPFlashCounter flashCounter("/counter");
|
|
flashCounter.increment();
|
|
Serial.print("Power Cycle ESPFlashCounter: ");
|
|
Serial.print(flashCounter.get());
|
|
Serial.println();
|
|
delay(3000);
|
|
ESP.reset();
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
|
|
}
|