How do you delete saved files?

I’ve played games like glove, squario, arduventure, and other things, and i’ve noticed that even if you install another game, then install that same game that you played before, the game will still say your previous scores. I was just wondering how to delete all the saved files.

Saved game data is stored in EEPROM. You can use the following sketch to erase all of the EEPROM used by sketches. NOTE that this will erase the scores and other data for every sketch that you’ve ever uploaded!

#include <Arduboy2.h>
#include <EEPROM.h>

Arduboy2 arduboy;

void setup() {
  arduboy.begin();
  arduboy.clear();
  arduboy.setCursor(0,0);
  arduboy.println("Erase all EEPROM?\nLEFT + B for YES\nRIGHT for NO\n");
  arduboy.display();
  while (1) {
    if (arduboy.pressed(LEFT_BUTTON + B_BUTTON)) {
      arduboy.println("Erasing EEPROM\nPlease wait...");
      arduboy.display();
      for (int i = EEPROM_STORAGE_SPACE_START; i < 1024; i++) {
        EEPROM.update(i, 0xff);
      }
      arduboy.print("Erase complete.\nUpload a new sketch.");
      arduboy.display();
      break;
    }
    if (arduboy.pressed(RIGHT_BUTTON)) {
      arduboy.print("Erase canceled.");
      arduboy.display();
      break;
    }
    delay(250);
  }
}

void loop() {
}
6 Likes

Thank you for the code you uploaded.

The code doesn’t seem to work with Arduventure though.

Arduventure is using the first 16 bytes of EEPROM. This area has been reserved by the Arduboy library for system use and should not be used by sketches, so my sketch above doesn’t clear it.

@DSSiege11 should modify Arduventure to only use EEPROM above EEPROM_STORAGE_SPACE_START which is defined in the Arduboy library.
Edit: This has now been done.

In the mean time, if you want to clear absolutely all of EEPROM, and thus include the area Arduventure is using, change EEPROM_STORAGE_SPACE_START to 0 in the sketch above.

2 Likes

Hello, I need your help.
I can´t delete Arduventure. I tried it, but nothing helps.
What can I do?

Thank You!

http://community.arduboy.com/t/how-to-use-flashlight-mode-to-fix-bricked-arduboys/2326/1

1 Like

THANK YOU! YOU SOLVED MY PROBLEM! HAVE A NICE DAY :slight_smile:

2 Likes