EEPROM library

Hi, I suspect that it I call EEPROM.write(addr) and addr is a number larger than the memory size, the higher order bits are just discarded. Is it so? Do you think it would it be nice to have a MAXEEPROMADDR constant defined as the last valid address, that would change depending on the board, so that I can write a code that runs on different arduinos, for instance the different versions of the NANO ? Otherwise a small data logger, for instance, would destroy previously stored values. What do you think ?

frikosal: I suspect that it I call EEPROM.write(addr) and addr is a number larger than the memory size, the higher order bits are just discarded. Is it so?

Yes.

Do you think it would it be nice to have a MAXEEPROMADDR constant defined as the last valid address, that would change depending on the board, so that I can write a code that runs on different arduinos, for instance the different versions of the NANO ?

Put this at the top of your Sketch and you'll be good to go...

define MAXEEPROMADDR E2END

Or, you can just use E2END.

Just tried, it works. Thanks ! Is that E2END constand described somewhere in the reference ?

http://www.nongnu.org/avr-libc/user-manual/group__avr__io.html