I'm making a score counter, and I want to save values of up to 9999, so I am using EEPROM.Put and EEPROM.get to save.
int ANum;
int BNum;
int CNum;
int DNum;
#include <EEPROM.h>
void setup()
{
Serial.begin(9600);
EEPROM.get(1, ANum);
EEPROM.get(2, BNum);
EEPROM.get(3, CNum);
EEPROM.get(4, DNum);
Serial.println(ANum);
Serial.println(BNum);
Serial.println(CNum);
Serial.println(DNum);
}
if (This part shouldn't be important. Tho for reference it's triggered by a button press)
{
EEPROM.put(1, ANum);
EEPROM.put(2, BNum);
EEPROM.put(3, CNum);
EEPROM.put(4, DNum);
}
P.S. I'm setting four digit displays to the ints, not logging it to serial.println, but to make it easier on you guys I added in the Serial.printl()'s. Also, the int's are set in other parts of the code, I just cherrypicked all the things involved in EEPROM so that it's less overwhelming and easier to sort through.
And instead of getting 5000 as one of the ints was set, I got 5093 and one int was at 126 and now is at 2882. I know that PUT is writing to multiple locations so it may be overwriting other locations, but I'm not sure how to prevent that? If that is even the issue or if that is ONE of the issues, thank you in advance, I also have a DEADLINE on this for 7/14/19 in the morning.