The code is good and should work. The issue might be this: The example code you posted is in the 'setup' section of the IDE and will only run at startup, once, when the Arduino boots up. Unless you are using this code elsewhere in your main loop then it will never run again and therefore not reset the eeprom. You could write a small subroutine with that code in it and call it from anywhere in your code.
If that answers your question, great, if not, post all your code.
|