06 EEPROM Read Write and Clear in Arduino

 EEPROM:-

EEPROM stands for electrically erasable programming read-only memory and is a type of non-volatile memory used in computers, integrated microcontroller for smart cards and remote keyless systems and other electronics devices to store relatively small amount of data but allowing individual bytes to be erased and reprogrammed.

The advantage of an EEPROM memory, apart from the fact that the data stored in non-volatile, is that it is possible to read data from it and also erase it and write data to it, To erase the data, a relatively high voltage is required.

Application of EEPROM with Arduino:-

The microcontroller on the Arduino board has EEPROM. The size of EEPROM in Arduino Uno, Nano and Mini is 1MB (1024 bytes) it can store byte variables. The variables stored in EEPROM kept there,
event when you reset or power off the Arduino. Simply, the EEPROM is permanent storage similar to hard drive in computers.

The EEPROM can be Read, re-write and erased electrically. In case of Arduino you can read and write from the EEPROM easily using the EEPROM library.

EEPROM Library in Arduino IDE:- 

Open Arduino IDE and go to File >> Eamples >> EEPROM. there are basics code for  EEPROM.

Writing EEPROM:-


You can easily Read, Write and clear EEROM by using EEEPROM library
To use EEPROM just include EEPROM library
 #include <EEPROM.h>  
To start Serial monitor use Serial.begin() function that take one argument is Baud rate in bit per second
 Serial.begin(9600);  
To write Data into EEPROM, You can use EEPROM.write() function. It take two argument one is EEPROM location means address where you want to write the data, and  second is the value what you want to save.
 EEPROM.write(Address, Value);   
To print on Serial monitor use Serial.print() function. It take one argument  is message what you want to print on Serial. Here  value and location address is printing on serial monitor.
  Serial.print(Address);  
Serial.print(" ");
Serial.println(Value);

Reading EEPROM:-

To read EEPROM use EEPROM.read() function. it will take one argument is only data address where data has been saved and you want to read.
 EEPROM.read(Address);  

Clear EEPROM:-

To Clear EEPROM there is no any special function to clear EEPROM so if you want to clear EEPROM then you have to write '0' in that particular address where you want to clear. so you can use EEPROM.write() function.
 EEPROM.write(Address, 0);  
Click here to download the Code


For more details watch video

Thanks for visiting.💗

No comments:

Powered by Blogger.