Skip to main content
Arduino

Return to Revisions

2 of 2
Commonmark migration

Beside Georgi's answer, I would like to tell you some details.

First :

a microcontroller can have a built-in EEPROM like the ATMega328 inside an Arduino UNO/Nano/mini, if not you would need to attach an external one, it can have may interfaces like SPI or IIC etc...

Second :

an EEPROM can hold only a specified amount of data, it can be 512byte like one on the ATMega328 microcontrollers, it can be only 64byte on others.

Third :

an EEPROM have addresses so for example in 8-bit EEPROM one address can hold only 8bits so values from (0-255) like on the ATMega328

Fourth : how to use it

In the beginning of your code you should first include the eeprom library

#include <EEPROM.h>

Then you would for example assign value "24" to one of the address on the EEPROM let's say address "1"

So you will use

EEPROM.write(1,24);

Of course you can power off you board and repower it again and that particular address will have the assigned 8-bit value "24".

To read back

EEPROM.read(24);

I hope that might help you or anyone else.

And as a side note an EEPROM have defined write and read cycles ~10000 maybe ~100000 after that amount it May not work.

Original documentation : here

AltStyle によって変換されたページ (->オリジナル) /