The Arduino microcontrollers have non volatile EEPROM memory built in. The EEPROM library allows you to read and write those bytes.

EEPROM Sizes:

1024 bytes

ATmega328

512 bytes

ATmega168
ATmega8

4KB (4096 bytes)

ATmega1280
ATmega2560. 

Using The Library

Note that you read and write one byte at a time – there is not an array read and write function.

Default eeprom values are 0xFF.


#include <EEPROM.h>

  BYTE value;
  BYTE address;

  address = 0
  EEPROM.write(address++, 0x50);
  EEPROM.write(address++, 0x51);

  address = 0
  value = EEPROM.read(address++);
  value = EEPROM.read(address++);

 

 

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *