1

Im having a problem where i got unsinged long variable and i need to increment it in eeprom everytime setup starts and it overflows at 255 back to 0.

unsigned long NumberOfBoots = 0UL;
#define INFO_NUMBER_OF_BOOTS_ADDR 0
#define INFO_NUMBER_OF_BOOTS_LEN sizeof(NumberOfBoots)

// in setup
EEPROM.get(INFO_NUMBER_OF_BOOTS_ADDR, NumberOfBoots);
EEPROM.update(INFO_NUMBER_OF_BOOTS_ADDR, ++NumberOfBoots);

My guess is that its due to Update() fuction. Any ideas?

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.