Hello, i'm working on my project and i want to keep statistics of use, like how many times it was runned, how many times has diode blinked and etc. I think EEPROM can store only one value, because other value won't works, it's true or it's possible to store more values than one?
It can store more than one value. Why do you think it can store only one?
i have code like this:
but if i check this with EEPROM.read(firstvalue); EEPROM.read(secondvalue);
it returns fake numbers on secondvalue
What is the type of your variables? Please post the full relevant code not only the "obvious" parts.
TeamA = EEPROM.read(teamaa); TeamA++; EEPROM.write(teamaa, TeamA);
in other function is this code, just changed other values
TeamB = EEPROM.read(teambb); TeamB++; EEPROM.write(teambb, TeamB);
and in statistics display is this code:
TeamA = EEPROM.read(teamaa); TeamB = EEPROM.read(teambb); lcd.print(TeamA); lcd.setcursor(0,1); lcd.print(TeamB);
What exactly of "What is the type of your variables?" didn't you understand?
type of variables is only numbers
“numbers” is not a C type. Please show the definitions, e.g.
uint8_t x; long y; float z;
do you think this? int TeamA = 0; int TeamB = 0; int teamaa = 0; int teambb = 0;
Yes, and this already provides the answer. "int" is a two bytes type. However the eeprom functions will only operate properly on 1 byte types. Thus you need to split each int into two bytes and read/write them separately. Or you go for some solution like this: http://arduino.cc/playground/Code/EEPROMWriteAnything