I am very much new to Arduino, but have been making good progress figuring this all out with its semicolons and curly brackets! When I have messed up the punctuation somewhere, it only takes seconds to track down the error, which is a relief.
I'm using Sparkfun's External_EEPROM library to store 4 bytes of numeric data, followed by a String of text data. I'm allowed ample room to accommodate the String. I am saving this data in a subroutine, and reading it back to verify it was saved. Because of the problems I'm having, I actually read it back to a different variable to be certain. This works; I get the same String back that I've stored.
The problem occurs when I read the memory locations in a second subroutine. The 4 bytes of numerical data are read fine, but the String data is scrambled. I read it twice, to different variables to be sure, and both have the same scrambled results.
Can anyone see whatever dump mistake I'm making?
I'm using Sparkfun's External_EEPROM library to store 4 bytes of numeric data, followed by a String of text data. I'm allowed ample room to accommodate the String. I am saving this data in a subroutine, and reading it back to verify it was saved. Because of the problems I'm having, I actually read it back to a different variable to be certain. This works; I get the same String back that I've stored.
C++:
myMem.put(Addr, KeySpecialFunctions); //(location, data)
myMem.put(Addr + 4, KeyStr); //(location, data)
// check storage
myMem.get(Addr, KeySpecialFunctions); //(location, data)
String ReadKeyStr;
myMem.get(Addr + 4, ReadKeyStr); //(location, data)
SerialUSB.println("EEPROM Readback");
SerialUSB.println(KeySpecialFunctions, BIN);
SerialUSB.println(ReadKeyStr);
The problem occurs when I read the memory locations in a second subroutine. The 4 bytes of numerical data are read fine, but the String data is scrambled. I read it twice, to different variables to be sure, and both have the same scrambled results.
Can anyone see whatever dump mistake I'm making?
C++:
myMem.get(Addr + 4, KeyData); //(location, data)
SerialUSB.print("Key string: ");
SerialUSB.println(KeyData);
SerialUSB.println("");
String ReadKeyStr;
myMem.get(Addr + 4, ReadKeyStr); //(location, data)
SerialUSB.println("EEPROM Readback");
SerialUSB.println(ReadKeyStr);