0

I'm working on Arduino pro mini. and I store some data in internal EEPROM.

So, I want to erase certain data from 0x00 to 0x28 address in EEPROM.

void loop()
{
 ...
 ...
 if(erase_eeprom_flag==1)
 {
   addr_uu=0;
          erase_eeprom_flag=0;
          for(kk=0;kk<28;kk++)
          {
              EEPROM.update(addr_uu,0);

              addr_uu=addr_uu+1;

          }
          Serial.println("OK");  
          Serial.println(addr_uu,DEC);
          addr_uu=0;
      }
  }

But I got a data like(28 times '0' and other data 'xxx') "0000000000000000000000000000xxxxxxxxxxxx".

ex : 20170519 ---> expected data: 00000519 (inappropriate data: 000020170519)

So, here actually push "0" / add at begin operation happen but I want to remove data from those address.

Please tell which Arduino function help me for solving my issue.

4

You are clearing 28 decimal bytes, but your address range is 28 hex bytes, or 40 bytes of data. Hence, the last 12 characters are untouched.

  • 41 bytes (decimal), counting the zero-th byte. Regardless, good catch. – JRobert Jul 29 '18 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.