iI am from Argentina.
IamI am making a kind of proyectproject for my car, and one of the many functions iI am thinkingplanning, is to check how many times the arudinoArudino has been powered up.
I was thinking of a simple counter and save it to the eepromEEPROM (using the SETUP VOIDwithin setup()).
I was able to save the value, and read it, but iI cannot add +1 to that value stored in the eepromEEPROM.
#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()
{
}
#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 iI am getting as output:
Write to EEPROM:
Read from EEPROM1: 12345678901234
Read from EEPROM2: 12345678901234
Read from EEPROM3: 370
The variable CANTcant is showing a diferentdifferent value.