Skip to main content
2 of 4
added 10 characters in body

Arduino simple PowerUp Counter

i am from Argentina.

Iam making a kind of proyect for my car, and one of the many functions i am thinking, is to check how many times the arudino has been powered up.

I was thinking a simple counter and save it to the eeprom (using the SETUP VOID).

I was able to save the value, and read it, but i cannot add +1 to that value stored in the eeprom.

#include <EEPROM.h>

char buffer[15]; // Largo de la variable, cantidad de caractares
int cant;

void setup()
{
   Serial.begin(9600);
   Serial.println("Write to EEPROM: ");
   EEPROM.put(0, "12345678901234");

   Serial.print("Read from EEPROM1: ");
   Serial.println(EEPROM.get(0, buffer));

   Serial.print("Read from EEPROM2: ");
   Serial.println(buffer);

   Serial.print("Read from EEPROM3: ");
   cant=(EEPROM.get(0, buffer));
   Serial.println(cant);
   
}

void loop()
{

}

And i am getting as output: Write to EEPROM: Read from EEPROM1: 12345678901234 Read from EEPROM2: 12345678901234 Read from EEPROM3: 370

The variable CANT is showing a diferent value.