Story
There was an annoying issue when I was testing an LED connected to my Arduino for power. If I wanted to turn the LED on or off, I would have to deal with STRANDED wires in the pin header. The only other way to make this work was to use the Serial Monitor on my computer. I'd instead use a pushbutton to toggle the LED, but I had no buttons.
But I did. The RESET button is a button, after all.
Circuit
All I needed for the circuit was a LED, a resistor (if necessary), and the Arduino.

Code
Once that was all hooked up, I started making the program:
#include
#define LED_PIN 13 // change to the pin of the LED
#define EEPROM_ADDRESS 0
void setup(){
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
if (EEPROM.read(EEPROM_ADDRESS) == 0){
EEPROM.put(EEPROM_ADDRESS, 1);
digitalWrite(LED_PIN, HIGH);
Serial.println("LED ON");
} else {
EEPROM.put(EEPROM_ADDRESS, 0);
digitalWrite(LED_PIN, LOW);
Serial.println("LED OFF");
}
}
void loop(){}
The code is pretty self-explanatory, and utilizes the built-in EEPROM to keep a value even when reset.
How to use
To turn the LED on or off, press the RESET button.
Be careful, the LED could randomly turn on if the circuit is shorted.
I like to put the LED on a pin other than 13 to avoid flashing on reset:
#define LED_PIN 12 // change to the pin of the LED
EXPANDED TECHNICAL DETAILS
Non-Volatile State Persistence
This "Hack" allows you to use the Arduino's built-in Reset button as a functional user input, preserving a setting across power cycles.
- EEPROM Memory Hub: Since the
Resetbutton wipes the RAM, the Arduino uses its internal 1,024 bytes of EEPROM to store the LED status (0 or 1). Upon every boot (which is triggered by the Reset), the code reads the EEPROM, "Flipped" the value, and writes it back. - Application Logic: Ideal for simple "Mode Selection" markers where adding an external button is physically impossible or inconvenient in a compact chassis.
Safety Logic
- EEPROM Lifecycle: Utilizes
EEPROM.update()to avoid unnecessary writes, ensuring the flash memory remains reliable for over 100,000 "Reset" cycles.