how to add eeprom for remember led on or off

this is two button led dimmer code. if i press button the led is on. when loss power and again when i input power the led is off. but i want the led is on. how can i add eeprom in this code. pls help me. here is my code

volatile int i=0;
void setup()
{
pinMode(3, OUTPUT);
pinMode(0, INPUT);
pinMode(1, INPUT);
}

void loop()
{
analogWrite(3, i);
if (digitalRead(0)==LOW)
{
if (i<255)
{
i++;
delay(30);
}
}
if (digitalRead(1)==LOW)
{
if (i>0)
{
i--;
delay(30);
}
}
}

switch_led_dimmer.ino (1.08 KB)

Have you tried any of the EEPROM examples?

Please remember to use code tags when posting code.

no i dont tried any eeprom example

To paraphrase the response from another web site:

Please be aware that this is not a free design house, homework-answering service or an on-demand online technical encyclopedia. Please revise your question to include the work you have achieved so far.

please anyone can help me? this code add eeprom and give me full complete code. if anyone can give me the code. i am new user and i want to learn

Start here

Mirajul:
please anyone can help me? this code add eeprom and give me full complete code. if anyone can give me the code. i am new user and i want to learn

Learn by doing.

Chuck.