Hi,
i need to store (read,write) 5 string like this "05000005329000" in the flash memory so when the arduino is power off it will keep the data in. I checked the eeprom fonction but it only one byte, i'm a little lost with that. and it is possible to create a list and able to modified it so if a sting is equal with a string in the list then do it?
Thanks in advance
Like i say i checked on the net but i'm lost whit that
smallpoul:
Hi,
i need to store (read,write) 5 string like this "05000005329000" in the flash memory so when the arduino is power off it will keep the data in. I checked the eeprom fonction but it only one byte, i'm a little lost with that. and it is possible to create a list and able to modified it so if a sting is equal with a string in the list then do it?
Thanks in advance
Like i say i checked on the net but i'm lost whit that
You can use PROGMEM to "compile in" your string into flash (program memory) and then read it out later.
If you need to write and re-write string data, then you need EEPROM. Why not do it this way:
const char *string1 = "05000005329000";
const char *string2 = "I am a string of a different length";
int x;
int address = 0; // base address to write or read the string
for (x = 0; x < strlen(string1); x++) {
EEPROM.write(address + x, string1[x]); // write string #1 to EEPROM
}
address += strlen(string1); // point to next free EEPROM area
for (x = 0; x < strlen(string2); x++) {
EEPROM.write(address + x, string2[x]); // write string #2 to EEPROM
}
Only thing you have to do is somehow keep track of where each string is stored and how long it is!
smallpoul:
Thanks,
yes it will help. could you tell me how to read it after that.
char buffer[32]; // must be at least as large as the stored string!
int x;
int address = 0; // base address where you stored the string
for (x = 0; x < 32; x++) { // assume the string was 32 bytes long
buffer[x] = EEPROM.read(address + x); // read EEPROM into buffer, 1 byte at a time
}
// "buffer" now contains the string that was stored in EEPROM