I want to know the purpose of using the EEPROM because I can't get it, I mean I know that it can store values for a long time, but I just can't get the goal here
#include<EEPROM.h>
void setup()
{
Serial.begin(9600);
EEPROM.write(0,4);
int s=EEPROM.read(0);
int f=10;
Serial.print(s);
Serial.print(" ");
Serial.print(10);
}
void loop()
{
{}
forFor example, imI'm using EEPROM to see the difference if I print a value inside variable ss
to the serial moniter using EEPROM and a normal value inside the variable ff
.
butBut I couldn't find the difference between both because when unplugging the power and turn it on again, both of them are printed.
hopeHope you got the idea and I hope to see some feedback.
thankThank you..
the LED program
then I made this program that will compare the EEPROM value to num.4 and compares the F variable to num.4 known that both F and the EEPROM values are 4. and then I changed both of the values to 3. shouldn't the GREEN LED of the EEPROM still on because it has already stored num.4??
#include<EEPROM.h>
void setup()
{
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
}
void loop()
{
EEPROM.write(0,4); //GREEN LED
int f=4; //RED LED
if(EEPROM.read(0)==4)
digitalWrite(12,HIGH);
if(f==4)
digitalWrite(11,HIGH);
}