I am creating a test program with Arduino Nano where I can save network and password. Here is my code to start with:
void SaveNetwork(String ssid, String pass){
String com = ssid + "~" + pass;
const char *array = com.c_str();
for(int i = 0; i<sizeof(com); i++){
EEPROM.write(i, array[i]);
}
Serial.println("Saved");
char ar[255] = ""; //test read string.
for(int i = 0; i<sizeof(com); i++){
ar[i] = EEPROM.read(i);
}
Serial.println(ar);
}
SaveNetwork("Testing", "Network123......");
Now I print ar string which is suppose to return ssid, "~" and password.
BUT what I get is "Testin" instead of "Testing~Network123......".
Is there is a limitation for EEPROM size? If so, how can I expand the capacity, should I use a memory chip, or what is the code I should use to resolve this?