Go Down

Topic: how to add eeprom for remember led on or off (Read 525 times) previous topic - next topic

Mirajul

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);
                                }
                }
}

AWOL

#1
Nov 24, 2017, 03:03 pm Last Edit: Nov 24, 2017, 03:03 pm by AWOL
Have you tried any of the EEPROM examples?

Please remember to use code tags when posting code.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Mirajul


dannable

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.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

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

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

chucktodd

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.
Currently built mega http server, Now converting it to ESP32.

Go Up