Reset Arduino 2560

How do I clear the memory on the arduino?
I have a Arduno Mega 2560.

How can I make it Like fresh out off the box.

Why clear it?

You overwrite an old sketch when you put in a new sketch

If you want to you can put in an sketch that does nothing - just like when you load the example sketch Bare Essentials.

Normally the board is loaded with the blink sketch, so LED 13 blinks when you apply power - as a sort of "Welcome" and verification that board is operational.

Thats the thing my LED 13 does not blink.

If you have used the EEPROM, you will need to clear that to 'empty the IC'. Have a look here: http://arduino.cc/en/Tutorial/EEPROMClear.

Onions.

Okay I ran the code and my LED 13 only blinks twice when it comes on and doesn't blink again until i press the reset button. Is that normal?
Thanks Onions for your effort.

Are you using the normal blink sketch? If you put the digitalWrite bit into setup, it will only run once.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);    
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

Onions.

This was the code i used:

/*

  • EEPROM Clear
  • Sets all of the bytes of the EEPROM to 0.
  • This example code is in the public domain.

*/

#include <EEPROM.h>

void setup()
{
// write a 0 to all 512 bytes of the EEPROM
for (int i = 0; i < 512; i++)
EEPROM.write(i, 0);

// turn the LED on when we're done
digitalWrite(13, HIGH);
}

void loop()
{
}

Is the Led 13 blinking twice is that normal. I will run your code and tell you how it goes.
Thanks again Onions

Same Result.

Ahh... The EEPROM clear turns on the LED when it is finished, that is perfectly normal. (And it was the EEPROM code that you uploaded, so it is working properly).
Msquare said:

Normally the board is loaded with the blink sketch, so LED 13 blinks when you apply power - as a sort of "Welcome" and verification that board is operational.

so you will need to upload the blink code (below) to have it 'box fresh'. Then, you will have an empty EEPROM and the welcome code loaded.

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
 */

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);    
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

Otherwise, upload the code below that does nothing, and you will have an empty EEPROM and no working code.

void setup(){}
void loop(){}

THANKS ALOT!

Its now blinking like when it came out of the box.

Thanks Onions XD