Hi! I want to write some data into Arduino EEPROM. Where an example (except what is shown in arduino tutorials) could be found?
Wal
Another question, do I need to clear the Arduino EEPROM before writing the new info?
Wal
Look at :- http://arduino.cc/en/Reference/EEPROM
this is how I save a 10 char string into the eeprom and read it back.
void read_eeprom_string(byte idx , char string[])
{
int base = idx*13;
for (int i=0; i <= 10; i++){
string[i] = EEPROM.read(base+i);}
}
void write_eeprom_string(byte idx , char string[])
{
int base = idx*13;
for (int i=0; i <= 10; i++){EEPROM.write( base+i , string[i]);}
}
Thank You Peter.
Hi,
just one note of caution, since you are using <= 10, you will be writing or reading 11 characters!
Steve
No need to clear the eeprom, just make sure that you only attempt to read memory locations that you have previously written to, otherwise expect garbage.