Hello!
I'm messing around with EEPROM, and I don't understand the interaction with addresses. When I would write something to address 1 and then something to address 2 it would overwrite this. Or if I would write something to address 1 and then use get for address 2 I would get the string I put in minus the first letter, why is this?
#include "Arduino.h"
#include <EEPROM.h>
struct fileStruc{ //Struct for file storage
char name[20];
int eeAddress;
};
typedef struct fileStruc file;
void setup() {
Serial.begin(9600);
writeEntry();
readEntry();
}
void writeEntry(){
file fl;
String test = "hello";
test.toCharArray(fl.name, 21);
fl.eeAddress = 1;
EEPROM.put(fl.eeAddress, fl);
}
void readEntry(){
char x[20];
Serial.println(EEPROM.get(2, x));
}
void loop() {
}