I am from Argentina.
I am making a kind of project for my car, and one of the many functions I am planning, is to check how many times the Arudino has been powered up.
I was thinking of a simple counter and save it to the EEPROM (within setup()).
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]; // length of the variable, character count
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 different value.