I have an app in which I save inputted text to EEPROM and then I retrieve it from EEPROM every time the app is launched. Here is the code I use to retrieve the EEPROM, divide it into parts and print out what is in each part.
char auth[32]="";
char userNameKey[32]="";
String abcd;
EEPROM.begin(512);
{
wwww = wwww + char(EEPROM.read(0x06+i)); //Read one by one with starting address of 0x0F
}
String zzz;
String uuuu;
for(int i=0;i<32;i++)
{uuuu = uuuu + char(EEPROM.read(0x50+i));
}
String yyyy = userNameKey;
String vvvv;
for(int i=0;i<33;i++)
{vvvv = vvvv + char(EEPROM.read(0x90+i));
}
wwww.toCharArray(auth,33);
Serial.println("Auth");
Serial.print(auth);
Serial.println("this");
Serial.print(wwww);
abcd = wwww;
Serial.println("that");
Serial.print(uuuu);
Serial.println("those");
Serial.print(vvvv);
int firstCommaIndex = uuuu.indexOf(',');
String dateOffset = uuuu.substring(0, firstCommaIndex);
Serial.println("most");
Serial.print(dateOffset);
int firstCommaIndexa = vvvv.indexOf(',');
String wstemp = vvvv.substring(0, firstCommaIndexa);
TRIPPER = wstemp;
WIFIER = wstemp;
int len = firstCommaIndexa;
wstemp.toCharArray(userr,len+1);
Serial.println("some");
Serial.print(wstemp);
When there has been no input and I Serial.print this I get.
Auth
16:11:05.204 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮this
16:11:05.204 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮that
16:11:05.204 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮those
16:11:05.204 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮most
16:11:05.204 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮some
16:11:05.242 -> ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮
and this is the printout when some text has been enter
Auth
16:35:57.878 -> XXX_UqXsXdCjcmqmNtUgkzb260Gdj0eLthis
16:35:57.878 -> XXX_UqXsXdCjcmqmNtUgkzb260Gdj0eLthat
16:35:57.878 -> -7,⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮those
16:35:57.878 -> SomeN,⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮most
16:35:57.911 -> -7some
16:35:57.911 -> SomeN
I would like to know if the char auth is in its original
char auth[32]="";
or it has been modified to include the input text.
if (auth == NULL) {
Serial.print ("auth empty");
}
if (*auth = '/0'){
Serial.print ("auth /0");
}
I have tried both of these but when there has been no input i get
auth /0
And after input I get
auth /0
I'm sure this is something simple but if someone would help me out I would greatly appreciate it.
So I figured out how to do this.
I took the code
firstCommaIndexa = vvvv.indexOf(',');
and asked this question
if (firstCommaIndexa >0) {
Serial.print ("comma present");
}
else {
Serial.print ("no comma present");
}
Not eloquent but it gets the job done.